Skip to main content

An async python wrapper for NASA open APIs.

Project description

aio-nasa

An async python wrapper for NASA open APIs. (api.nasa.gov)

Disclaimer

This module is still in the development/testing phase. Bugs are still being worked out and breaking changes are common.

Current Progress: 1/17 APIs

  • APOD: NASA Astronomy Picture of the Day
    • API: complete
    • CLI: complete
    • Documentation: needs work
  • InSight: Mars Weather Data
    • API: needs work
    • Documentaion: needs work
  • Exoplanet: NASA Exoplanet Database
    • API: incomplete
  • Asteroids-NeoWs: Near Earth Object Web Service
    • API: incomplete

Installing

aionasa can be installed from pypi with the command:

# Linux
python3 -m pip install -U aionasa

# Windows
python -m pip install -U aionasa

To install the development version of the library directly from source:

$ git clone https://github.com/nwunderly/aionasa
$ cd aionasa
$ python3 -m pip install -U .

Quickstart

We'll be using IPython because it supports await expressions directly from the console.

$ pip install aionasa ipython
$ ipython
from aionasa import APOD, InSight

async with APOD() as apod:
    picture = await apod.get()

picture.url # this will be the most recent APOD image URL.

async with InSight() as insight:
    data = await insight.get()

data # this will be a dict containing the JSON data returned by the API.

Python Script Example - APOD

This is a simple script that will return the title, explanation, and url from the most recent Astronomy Picture of the Day page, then download and save the image.

import asyncio
from aionasa import APOD

async def main():
    async with APOD() as apod:
        apod_entry = await apod.get()
        print(f'{apod_entry.title}\n{apod_entry.explanation}\n{apod_entry.hdurl}')
        await apod_entry.save()

asyncio.run(main())

CLI Example - APOD

This command, like the above python script, will print data returned by the APOD API, then download and save the image.

python3 -m aionasa.apod --print --download .

Feedback

I'd love to hear any feedback on this project so far. It's early in development so the library's design is still being worked out. Any design ideas or feature requests would be very helpful.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

aionasa-0.1.1.tar.gz (11.9 kB view hashes)

Uploaded source

Built Distribution

aionasa-0.1.1-py3-none-any.whl (15.6 kB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page