{"id":20130406,"url":"https://github.com/aschleg/nasapy","last_synced_at":"2025-07-13T06:33:01.009Z","repository":{"id":46022766,"uuid":"205863696","full_name":"aschleg/nasapy","owner":"aschleg","description":"Python wrapper for the NASA API https://api.nasa.gov","archived":false,"fork":false,"pushed_at":"2021-11-19T15:01:23.000Z","size":18642,"stargazers_count":11,"open_issues_count":3,"forks_count":7,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-09T16:15:23.385Z","etag":null,"topics":["api-wrapper","nasa","nasa-api","nasa-data","python3","space"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/aschleg.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-09-02T13:31:04.000Z","updated_at":"2024-09-03T01:28:45.000Z","dependencies_parsed_at":"2022-08-24T19:12:19.036Z","dependency_job_id":null,"html_url":"https://github.com/aschleg/nasapy","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aschleg%2Fnasapy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aschleg%2Fnasapy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aschleg%2Fnasapy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aschleg%2Fnasapy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aschleg","download_url":"https://codeload.github.com/aschleg/nasapy/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248065282,"owners_count":21041872,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api-wrapper","nasa","nasa-api","nasa-data","python3","space"],"created_at":"2024-11-13T20:38:32.406Z","updated_at":"2025-04-09T16:15:33.738Z","avatar_url":"https://github.com/aschleg.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# NasaPy\n\n[![Documentation Status](https://readthedocs.org/projects/nasapy/badge/?version=latest)](https://nasapy.readthedocs.io/en/latest/?badge=latest)\n[![CircleCI](https://circleci.com/gh/aschleg/nasapy/tree/master.svg?style=svg)](https://circleci.com/gh/aschleg/nasapy/tree/master)\n[![Coverage Status](https://coveralls.io/repos/github/aschleg/nasapy/badge.svg)](https://coveralls.io/github/aschleg/nasapy)\n[![codecov](https://codecov.io/gh/aschleg/nasapy/branch/master/graph/badge.svg)](https://codecov.io/gh/aschleg/nasapy)\n[![Codacy Badge](https://api.codacy.com/project/badge/Grade/ff660e1ce59a432493b19bd6f4751347)](https://www.codacy.com/manual/aschleg/nasapy?utm_source=github.com\u0026amp;utm_medium=referral\u0026amp;utm_content=aschleg/nasapy\u0026amp;utm_campaign=Badge_Grade)\n[![Dependencies](https://img.shields.io/librariesio/github/aschleg/nasapy.svg?label=dependencies)](https://libraries.io/github/aschleg/nasapy)\n[![https://pypi.org/project/nasapy/](https://img.shields.io/badge/pypi%20version-0.2.7-blue.svg)](https://pypi.org/project/nasapy/)\n[![https://pypi.org/project/nasapy/](https://img.shields.io/badge/python-3.4%2C%203.5%2C%203.6%2C%203.7%2C%203.8-blue.svg)](https://pypi.org/project/nasapy/)\n\nPython wrapper for the [nasa.gov API](https://api.nasa.gov/).\n\n## Installation\n\n`nasapy` is most easily installed using `pip`.\n\n```bash\npip install nasapy\n```\n\nThe library can also be cloned or downloaded into a location of your choosing and then installed using the `setup.py` \nfile per the following:\n\n~~~ bash\ngit clone git@github.com:aschleg/nasapy.git\ncd nasapy\npython setup.py install\n~~~\n\n## Documentation\n\n* [nasapy Documentation](https://nasapy.readthedocs.io/)\n* [Nasa's API documentation page](https://api.nasa.gov/)\n\n## Requirements\n\n* Python 3.4+\n* `requests\u003e=2.18`\n* `pandas\u003e=0.22.0`\n  - Although not strictly required to use `nasapy`, the [pandas](https://pandas.pydata.org/) library is needed \n    for returning results as a DataFrame.\n\n## Tutorials and In-Depth Examples\n\nThe following are articles that explore a facet of the `nasapy` library in more depth.\n\n* [Plot Earth Fireball Impacts with nasapy, pandas and folium](https://medium.com/@AaronSchlegel/plot-earth-fireball-impacts-with-nasapy-pandas-and-folium-46bb8bd0b99a)\n* [Analyzing the Next Decade of Earth Close-Approaching Objects with nasapy](https://medium.com/@AaronSchlegel/analyzing-the-next-decade-of-earth-close-approaching-objects-with-nasapy-8a6194c4a493)\n* [Get All NASA Astronomy Pictures of the Day from 2019](https://medium.com/@AaronSchlegel/get-all-nasa-astronomy-pictures-of-the-day-from-2019-with-python-and-nasapy-c31875e2c48)\n\n## Examples and Usage\n\nAlthough not strictly required to begin interacting with the NASA API, it is recommended to sign up \nto receive an [API access key](https://api.nasa.gov/) that has a significantly higher usage limit available compared \nto the demo key option. Many methods do not require an API key, but for those that do, it is typically a good option to \nuse a provided API key rather than the demo key. Using a received API key allows for 1,000 requests per hour, while the \ndemo key has 30 requests limit per hour and 50 requests per day.\n\n### Authentication\n\nAssuming an API key was received after signing up, authentication to the NASA API happens when initializing the `Nasa` \nclass.\n\n~~~ python\nnasa = Nasa(key=key)\n~~~  \n\nIf using a demo key, the initialization does not require any parameters to be passed.\n\n~~~ python\nnasa = Nasa()\n~~~\n\n### Remaining Requests Available\n\nThe `limit_remaining` attribute of the initialized `Nasa` class allows one to see the number of available requests \nremaining.\n\n~~~ python\nnasa.limit_remaining\n~~~\n\n### Examples\n\nThe following are some quick examples to get started.\n\n#### Astronomy Picture of the Day\n\n~~~ python\n# Return today's picture of the day\nnasa.picture_of_the_day()\n# Return a previous date's picture of the day with the high-definition URL included.\nnasa.picture_of_the_day('2019-01-01', hd=True)\n~~~\n\n#### Mars Weather\n\n~~~ python\n# Return the most recent data for the previous seven Sols (Martian Days)\nnasa.mars_weather()\n~~~\n\n#### Asteroid Feed\n\n~~~ python\n# Get asteroids approaching Earth at the beginning of 2019.\nnasa.asteroid_feed(start_date='2019-01-01')\n~~~\n\n#### Get Asteroid Data\n\n~~~ python\n# Get entire asteroid data set.\nnasa.get_asteroids()\n# Get asteroid with ID 3542519\nnasa.get_asteroids(asteroid_id=3542519)\n~~~\n\n#### DONKI (Space Weather Database of Notifications, Knowledge and Information)\n\n~~~ python\n# Coronal Mass Ejection Event Data\n\n# View data from coronal mass ejection events from the last thirty days\nnasa.coronal_mass_ejection()\n# View all CME events from the beginning of 2019.\nnasa.coronal_mass_ejection(start_date='2019-01-01', end_date=datetime.datetime.today())\n\n# Geomagnetic Storm Event Data\n\n# Get geomagnetic storm events from the last thirty days.\nnasa.geomagnetic_storm()\n\n# Solar Flare Event Data \n\n# Get solar flare events from May of 2019\nnasa.solar_flare(start_date='2019-05-01', end_date='2019-05-31')\n\n# Solar Energetic Particle Data\n\n# Get data from April 2017\nnasa.solar_energetic_particle(start_date='2017-04-01', end_date='2017-04-30')\n\n# Magnetopause Crossing Data\n\n# Get data on magnetopause crossing events from 2018 to the current date.\nnasa.magnetopause_crossing(start_date='2018-01-01')\n\n# Radiation Belt Enhancement Data\n\n# Get data on radiation belt enhancement events from the last 30 days.\nnasa.radiation_belt_enhancement()\n\n# Hight Speed Stream Data\n\n# Get data on hight speed stream events from the beginning of September 2019.\nnasa.hight_speed_stream()\n\n# WSA Enlil-Simulation Data\n\n# Get data from the first simulation performed in 2019.\nwsa = n.wsa_enlil_simulation(start_date='2019-01-01')\nwsa[0]\n~~~\n\n#### EPIC (DSCOVR's Earth Polychromatic Imaging Camera)\n\n~~~ python\n# Get EPIC data from the beginning of 2019.\ne = nasa.epic(date='2019-01-01')\n# Print the first result\ne[0]\n~~~\n\n#### Exoplanets\n\n~~~ python\n# Get all exoplanets data as a pandas DataFrame.\nexoplanets(return_df=True)\n# Get all confirmed planets in the Kepler field.\nexoplanets(where='pl_kepflag=1')\n# Stars known to host exoplanets as a pandas DataFrame.\nexoplanets(select='distinct pl_hostname', order='pl_hostname', return_df=True)\n~~~\n\n#### Landsat Images for a given Latitude-Longitude\n\n~~~ python\n# Get imagery at latitude 1.5, longitude 100.75 and include the computed cloud score calculation.\nnasa.earth_imagery(lon=100.75, lat=1.5, cloud_score=True)\n\n# Get assets available beginning from 2014-02-01 at lat-lon 100.75, 1.5\nnasa.earth_assets(lat=100.75, lon=1.5, begin_date='2014-02-01')\n~~~ \n\n#### Available Image data collected by the Mars rovers Curiosity, Discovery and Spirit.\n\n~~~ python\n# Return image data collected on Curiosity's 1000th sol.\nnasa.mars_rover(sol=1000)\n~~~\n\n#### Access GeneLab and Other Bioinformatics Databases\n\n~~~ python\n# Find Gene studies in the cgene database related to 'mouse liver'\nn.genelab_search(term='mouse liver')\n~~~ \n\nThe following functions do not require authentication with an API or demo key.\n\n#### CelesTrak Two-Line Element Set Records\n\n~~~ python\n# Retrieve available data for a specific satellite ID.\ntle(satellite_number=43553)\n~~~ \n\n#### Search for Available Imagery and Audio from the images.nasa.gov API\n\n~~~ python\n# Search for media related to 'apollo 11' with 'moon landing' in the description of the items.\nr = media_search(query='apollo 11', description='moon landing')\n# Print the first returned media item from the resulting collection.\nr['items'][0]\n~~~\n\n#### Asteroid and Comet Close Approaches to planets in the past and future\n\n~~~ python\n# Get all close-approach object data in the year 2019 with a maximum approach distance of 0.01AU.\nclose_approach(date_min='2019-01-01', date_max='2019-12-31', dist_max=0.01)\n# Get close-approach data for asteroid 433 Eros within 0.2AU from the years 1900 to 2100.\nclose_approach(des='433', date_min='1900-01-01', date_max='2100-01-01', dist_max=0.2)\n# Return close-approach data from the beginning of 2000 to the beginning of 2020 as a pandas DataFrame.\nclose_approach(date_min='2000-01-01', date_max='2020-01-01', return_df=True)\n~~~\n\n#### Fireball atmospheric impact data reported by US Government sensors\n\n~~~ python\n# Get all available data in reverse chronological order\nn = fireballs()\n# Return the earlieset record\nfireballs(limit=1)\n# Get data from the beginning of 2019\nfireballs(date_min='2019-01-01')\n# Return fireball data from the beginning of the millennium to the beginning of 2020 as a pandas DataFrame.\nfireballs(date_min='2000-01-01', date_max='2020-01-01', return_df=True)\n~~~\n\n#### Jet Propulsion Laboratory/Solar System Dynamics small body mission design suite API\n\n~~~ python\n# Search for mission design data for SPK-ID 2000433\nr = mission_design(spk=2000433)\n# Print the object data from the returned dictionary object.\nr['object']\n~~~\n\n#### Get Data on Near-Earth Object Human Space Flight Accessible Targets\n\n~~~ python\n# Get all available summary data for NHATS objects.\nn = nhats()\n# Get summary data as a pandas DataFrame\nn = nhats(return_df=True)\n# Get the results from a 'standard' search on the NHATS webpage.\nnhats(delta_v=6, duration=360, stay=8, magnitude=26, launch='2020-2045', orbit_condition_code=7)\n# Return data for a specific object by its designation\nnhats(des=99942)\n~~~\n\n#### Get Data from NASA's Center for Near-Earth Object Studies (CNEOS) Scout system\n\n~~~ python\n# Get all available summary data.\nscout()\n# Return all summary data as a pandas DataFrame.\nscout(return_df=True)\n# Return data and plot files for a specific object by its temporary designation. Note the object may no longer\n# exist in the current database\nscout(tdes='P20UvyK')\n# Get ephemeris data for a specific object at the current time with a Field of View diameter of 5 arc-minutes\n# with a limiting V-magnitude of 23.1.\nscout(tdes='P20UvyK', fov_diam=5, fov_vmag=23.1)\n~~~\n\n#### Get Data from the Center for Near Earth Object Studies (CNEOS) Sentry system\n\n~~~ python\n# Get summary data for available sentry objects.\nsentry()\n# Get summary data as a pandas DataFrame\nsentry(return_df=True)\n# Get data for a specific Sentry object by its designation.\nsentry(des=99942)\n# Get data for objects removed from the Sentry system.\nsentry(removed=1)\n~~~\n\nOther function examples\n\n#### Getting the Julian and Modified Julian Date\n\n~~~ python \n# Return the modified Julian Date for the current time.\njulian_date()\n# Return the non-modified Julian Date for the current time.\njulian_date(modified=False)\n# Get the modified Julian Date for 2019-01-01 at midnight.\njulian_date(year=2019)\n~~~\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faschleg%2Fnasapy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faschleg%2Fnasapy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faschleg%2Fnasapy/lists"}