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). Also, can not be before Jun 16, 1995. 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
from datetime import datetime

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

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

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

# fetching data from specific date
print(apod.get_apod({
    "date": datetime(year=2020, month=10, day=12)
}))

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.5.tar.gz (5.0 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.5-py3-none-any.whl (5.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: nasawrapper-0.0.5.tar.gz
  • Upload date:
  • Size: 5.0 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.5.tar.gz
Algorithm Hash digest
SHA256 3f571738b405aeecd8d85a0302972881d1030f667f5a88302563f59e5ede81fd
MD5 39a81a666d42743cd9e8f23a03ebba79
BLAKE2b-256 c3cc4b983f04619514822b8b9dc6e8b60236f1b344650f7c839d4a65a245575f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: nasawrapper-0.0.5-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.5-py3-none-any.whl
Algorithm Hash digest
SHA256 f74c935e9718870b3533e0c8d370682fc47aad60326fc669dd4c72208be6eb07
MD5 d6271fb03ee3d5ea6aedcd37e177a4d7
BLAKE2b-256 d995045ac8f73c9796e2a12df824cca37118b9172f28b84786493ed8736ad578

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