SpaceData
SpaceData is a high-performance, asynchronous Python SDK for NASA's open APIs. It provides a type-safe interface for retrieving astronomical data, near-Earth objects, and space weather information.
Purpose
To simplify access to NASA's complex data structures by providing a unified, developer-friendly client with built-in utilities for data analysis and media handling.
Installation
pip install spacedata
API Key: While the SDK works with the default DEMO_KEY, we recommend getting a free API key from NASA for higher rate limits and production use.
Features
- Async Support: Efficient non-blocking I/O using
httpx - Type Safety: Full Pydantic integration for validation and autocompletion
- Smart Automation:
- Automatic pagination handling
- Date-range splitting for large queries
- Media file downloading
- Data Science Ready:
- Convert results to Pandas, Polars, or PyArrow
- Export directly to DataFrames for analysis
- Performance:
- Built-in caching (in-memory or DuckDB)
- Automatic retry with exponential backoff
Examples
1. Astronomy Picture of the Day
import asyncio
from spacedata import SpaceDataClient
async def main():
async with SpaceDataClient() as client:
result = await client.planetary.apod(start_date="2025-01-01", end_date="2025-01-05")
async for item in result:
print(f"{item.date}: {item.title}")
if __name__ == "__main__":
asyncio.run(main())
2. Near-Earth Objects (NEO) Lookup
import asyncio
from spacedata import SpaceDataClient
async def main():
async with SpaceDataClient() as client:
result = await client.neo.lookup(asteroid_ids=[3542519])
async for asteroid in result:
print(f"Asteroid: {asteroid.name} (Hazardous: {asteroid.is_potentially_hazardous_asteroid})")
if __name__ == "__main__":
asyncio.run(main())
3. Convert to DataFrame for Analysis
import asyncio
from spacedata import SpaceDataClient
async def main():
async with SpaceDataClient() as client:
result = await client.neo.feed(start_date="2025-01-01", end_date="2025-01-31")
df = await result.to_pandas()
print(f"Found {len(df)} asteroids")
print(df[['name', 'is_potentially_hazardous_asteroid']].head())
if __name__ == "__main__":
asyncio.run(main())
Documentation
Core
Resources
Planetary
| Resource | Description | Docs |
|---|---|---|
| APOD | Astronomy Picture of the Day | View |
Near-Earth Objects (NEO)
| Resource | Description | Docs |
|---|---|---|
| NEO Feed | Near-Earth Objects by date range | View |
| NEO Lookup | Specific NEO details by ID | View |
| NEO Browse | Full Near-Earth Object database | View |
InSight
| Resource | Description | Docs |
|---|---|---|
| Mars Weather | Mars atmospheric data from InSight lander | View |
DONKI (Space Weather Events)
| Resource | Description | Docs |
|---|---|---|
| CME | Coronal Mass Ejections events | View |
| CME Analysis | CME analysis with ENLIL simulations | View |
| FLR | Solar Flare events | View |
| GST | Geomagnetic Storm events | View |
| HSS | High Speed Stream events | View |
| IPS | Interplanetary Shock events | View |
| MPC | Magnetopause Crossing events | View |
| RBE | Radiation Belt Enhancement events | View |
| SEP | Solar Energetic Particle events | View |
| WSA | WSA+ENLIL solar wind simulations | View |
| Notifications | Space weather notification messages | View |
Metadata
Release files for spacedata 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| spacedata-0.1.1.tar.gz | 22.8 kB | Without provenance | Details for spacedata-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| spacedata-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for spacedata-0.1.1-py3-none-any.whl |
Total release size: 61.8 kB
Release files / spacedata-0.1.1.tar.gz
| Download URL | spacedata-0.1.1.tar.gz |
|---|---|
| Size | 22.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
212c3c7c86c0e37ef828ac4dda0fb2a5dd61fbf1970d7ebc81865e2968d6b850
|
|
BLAKE2b-256 checksum How to use checksums |
ea050e008102c8d6de97475932d967682abeef9430b2bb772354104a395fba01
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.21 {"installer":{"name":"uv","version":"0.9.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Arch Linux ARM","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / spacedata-0.1.1-py3-none-any.whl
| Download URL | spacedata-0.1.1-py3-none-any.whl |
|---|---|
| Size | 39.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c12c82150610a0ccf09bade6dd8be89a01ea5acb7fe4e87f628bf66dd4d771a1
|
|
BLAKE2b-256 checksum How to use checksums |
7b2023790670bf0c81ec61303b0bc729d37dc7057c5899996b9cd786fdfde69b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.21 {"installer":{"name":"uv","version":"0.9.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Arch Linux ARM","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Security for spacedata 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.