https://github.com/juancarlospaco/nim-usagov
USA Code.Gov MultiSync API Client for Nim. Get data & code from NASA, LIGO, Fermilab & more on seconds!
https://github.com/juancarlospaco/nim-usagov
async government-data nim nim-lang open-data scientific-data united-states
Last synced: about 2 months ago
JSON representation
USA Code.Gov MultiSync API Client for Nim. Get data & code from NASA, LIGO, Fermilab & more on seconds!
- Host: GitHub
- URL: https://github.com/juancarlospaco/nim-usagov
- Owner: juancarlospaco
- License: mit
- Created: 2018-10-17T05:41:10.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2019-05-26T05:48:16.000Z (almost 6 years ago)
- Last Synced: 2025-01-26T14:48:39.963Z (4 months ago)
- Topics: async, government-data, nim, nim-lang, open-data, scientific-data, united-states
- Language: HTML
- Homepage: http://htmlpreview.github.io/?https://raw.githubusercontent.com/juancarlospaco/nim-usagov/master/usagov.html
- Size: 764 KB
- Stars: 4
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# Nim-USAGov
- [USA Code.Gov](http://code.gov) MultiSync API Client for [Nim](https://nim-lang.org). Get data & code from NASA, LIGO, Fermilab & more on seconds!

Code.gov is on a mission to become the primary platform where America shares code.
Code.gov API is a public API. Data from the API will be delivered in JSON.
This Client is Async & Sync at the same time. CrossPlatform. CrossArchitecture. 0 Dependency. 1 File. ~250Kilobytes Compiled. Can run itself for an example. Proxy, IPv6, SSL & Timeout Support. Tiny RAM use. Self Rate Limited at 5000 Calls/Day. Self-Documented.
# Install
```
nimble install usagov
```# Use
```nim
import usagov# Sync client.
let codegov_client = USAGov(timeout: 9, apikey: "DEMO_KEY")
echo $codegov_client.repos(q="python")
echo $codegov_client.agencies()
echo $codegov_client.languages()
echo $codegov_client.repo()
echo $codegov_client.status()
echo $codegov_client.version()# Async client.
proc asyncodegov {.async.} =
let
async_codegov_client = AsyncUSAGov(timeout: 9, apikey: "DEMO_KEY")
async_response = await async_codegov_client.version()
echo $async_responsewait_for asyncodegov()
# Check the Docs for more API Calls...
```# API
- [Check the Code.Gov Docs](https://api.code.gov), the Lib is a 1:1 copy of the official Docs.
- This Library uses API Version from Year `2018`.
- All procs should return a JSON Object `JsonNode`.
- The order of the procs follows the order on the Code.Gov Docs.
- The naming of the procs follows the naming on the Code.Gov Docs.
- The errors on the procs follows the errors on the Code.Gov Docs.
- The API Rate Limit follows the limits on the Code.Gov Docs.
- All API Calls use HTTP `GET`.
- The `timeout` argument is on Seconds.
- For Proxy support define a `proxy` of `Proxy` type.
- No OS-specific code, so it should work on Linux, Windows, Mac, etc.
- Run `nim doc usagov.nim` to generate the self-Documentation.
- Run the module itself for an Example.# Screenshots

# Support
- All Code.Gov API is supported, except fetching static HTML pages.
# FAQ
- I dont live in US why should I care?.
Lots of Scientific/Educational/Medical institutions have base on US.
You can explore and hack on code from NASA, LIGO, among others.
All Public funded code should be Open Source.- This works with Asynchronous code ?.
Yes.
- This works with Synchronous code ?.
Yes.
- This works without SSL ?.
No.
- This requires API Key or Login ?.
Yes. 1 Free API Key. Easy to obtain.
- This requires Credit Card or Payments ?.
No.
- Can I use the Code.Gov data ?.
Yes. All source code is Open source.
# Requisites
- None.