Skip to content

Snipy7374/nasa.py

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

44 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

nasa.py

GitHub license file GitHub commit activity

Work in progress

to run the docs use

sphinx-autobuild -a docs/source docs/_build/html --watch nasa

Demo

image

Installation

Currently the package is not available on pypi, this means that you can't install it using just pip. To install Nasa.py you need to install git and to run this command

pip install git+https://github.com/Snipy7374/nasa.py

Requirements

aiohttp
aiofiles
requests

Basic usage

Create a client object

import typing as t
from nasa import NasaSyncClient

if t.TYPE_CHECKING:
    from nasa import AstronomyPicture

client = NasaSyncClient(token="TOKEN_HERE")

get the todays astronomy picture

astronomy_picture: AstronomyPicture = client.get_astronomy_picture()

save an image

astronomy_picture.image.save("image.png")

This library also supports Async requests

import typing as t
from nasa import NasaAsyncClient

if t.TYPE_CHECKING:
    from nasa import AstronomyPicture

client = NasaAsyncClient(token="TOKEN_HERE")

async def main():
    async with client:
        astronomy_picture: AstronomyPicture = await client.get_astronomy_picture()
        await astronomy_picture.image.save("image.png")

Currently supported NASA API endpoints

  • APOD (Astronomy picture of the day) - /planetary/apod - (all query parameters)

TODO

  • Add is_video property on AstronomyPicture (based on media_type)
  • Add support for the count query parameter on /planetary/apod endpoint to get multiple random image
  • Solve typing issues with typing.overloads on client.py
  • Support other endpoints
  • Add async client & methods
  • Add logging
  • Add docs :)
  • Add developing tools
  • Add workflows on github
  • Create the first release
  • Upload the project on PyPi
  • Customize the docs
  • Add examples