Skip to main content

A wrapper for NASA APIs

Project description

Warnings

This library is an alpha release yet, maybe there are some bugs, please report them to issues page.

Credits

Every API used in this library is avaliable on NASA API portal. This is just a simple wrapper to fetch their APIs and this library does not have any relationship to NASA, every issue/suggestion should be reported on the issues page.
The documentation provided on this readme has inspiration on the documentation provided on the NASA API portal about their APIs.

Instalation

You can install this package by PIP using the following command:

pip install nasawrapper

Updating package

Updating package using PIP:

pip install --upgrade nasawrapper

Documentation

APOD

This API has the following description in their website: "Each day a different image or photograph of our fascinating universe is featured, along with a brief explanation written by a professional astronomer.".
The class responsable for this API is Apod, which you have to instantiate with 2 parameters: an api key (you can get it here) and a boolean indicating if you want to be warned about some eventually alerts when using the wrapper (defaults to True).
Example:

from nasawrapper import Apod

apod = Apod("your-api-key", False)
# in this case, it will not warn you on the console

# setting the second variable to True or not specifying
# it will make the lib warn you in the console

This class has only one method which make the request to the API, called get_apod. For using it, you have to provide a single parameter (a dict) with some keys with the information you want to use to make the request. Avaliable keys are:

Parameter Function Type
date The date of the APOD image to retrieve (must be in format YYYY-MM-DD) datetime.datetime
start_date The start of a date range, when requesting date for a range of dates. Cannot be used with date (must be in format YYYY-MM-DD). datetime.datetime
end_date The end of the date range, when used with start_date. Can not be used without start_date and can not be after start_date (must be in format YYYY-MM-DD). datetime.datetime
count If this is specified then count randomly chosen images will be returned. Cannot be used with date or start_date and end_date. int
thumbs Return the URL of video thumbnail. If an APOD is not a video, this parameter is ignored. bool

You can not provide any other parameters, or an error will be thrown.
Examples:

from nasawrapper import Apod

apod = Apod("your-api-key", False)

# fetching data between two dates
print(apod.get_apod({
    "start_date": "2020-10-10",
    "end_date": "2020-10-11",
    "thumbs": True
}))

# fetch specific number of data
print(apod.get_apod({
    "count": 5
}))

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

nasawrapper-0.0.4.tar.gz (4.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

nasawrapper-0.0.4-py3-none-any.whl (5.2 kB view details)

Uploaded Python 3

File details

Details for the file nasawrapper-0.0.4.tar.gz.

File metadata

  • Download URL: nasawrapper-0.0.4.tar.gz
  • Upload date:
  • Size: 4.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.6

File hashes

Hashes for nasawrapper-0.0.4.tar.gz
Algorithm Hash digest
SHA256 dc528e7bb47e37a52e4c6dbcb5f743da768b2ff12c16decb7df196b859cc4d95
MD5 40342c24fee2cfc0c3bd4fb879f5d7d6
BLAKE2b-256 4fa6d23eae87dcb5e84cb41ed6025e1d2adfd0ef9113616496c56c20de978bc4

See more details on using hashes here.

File details

Details for the file nasawrapper-0.0.4-py3-none-any.whl.

File metadata

  • Download URL: nasawrapper-0.0.4-py3-none-any.whl
  • Upload date:
  • Size: 5.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.6

File hashes

Hashes for nasawrapper-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 0557e07296bbb01c4dbe0145999649214c8a8be754dc3924cde343983c79aa2b
MD5 97036da72b2366cf7f8ed76a609c4867
BLAKE2b-256 6eb546ae8a15b84ec733aaa442c691d821dc1b8005e52daf8be18b1c9c7f4aca

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page