Simple wrapper for NASA Api written in python which was previously written by abh80 in Javascript as NPM which is deprecated now so i aka Science Spot recreated it in Python using requests modules!
You need NASA's Official API to use this module!
# Import Client Class from nasaapi import Client # Load your api nasa = Client(api) # Replace your api with the original one!print(nasa.apod()) # Will return a dict print(nasa.apod_image()) # Will retun apod image urlprint(nasa.earth(lat, lon, date)) # Lat Lon parameters should be latitude and longitude # Date parameter should be in the form of YYYY-MM-DD # Will return a dict print(nasa.earth_image(lat, lon, date)) # Will return image urlprint(nasa.insight()) # Will return a dictThere are two methods to get this data
1. Using MarsRovers Class
from nasaapi import MarsRovers rovers = MarsRovers(api_key, sols, camera) # api_key would be your NASA Api key. Sols would be the Mars Days. Camera is the name of camera to view print(rovers.curiosity()) # Get data of Curiosity Rover print(rovers.opportunity()) # Get data of Oportunity Rover print(rovers.spirit()) # Get data of Spirit Rover2. Using Client Class
rovers = nasa.mars_rovers(sols, camera) # Sols would be the Mars Days. Camera is the name of camera to view print(rovers.curiosity()) # Get data of Curiosity Rover print(rovers.opportunity()) # Get data of Oportunity Rover print(rovers.spirit()) # Get data of Spirit RoverGet data of nasa's techport
print(nasa.techport(id)) # ID will be the id of the techport project! # Will return dict unless its a better idGet data of nasa's tle
print(nasa.tle.search(query)) # Will return data of a search print(nasa.tle.get(query)) # Will get of 1 data onlyGet images, Search Images, and other image and video library of NASA
print(nasa.nivl.search(query)) # Query will be the query you will search print(nasa.nivl.asset(id)) # Get Asset by ID print(nasa.nivl.metadata(id)) # Get Metadata by ID print(nasa.nivl.captions(id)) # Get Captions by ID