Skip to main content

Python client for space-track.org

Project description

PyPI Version Documentation CI Status Coverage Python Version MIT License

spacetrack is a python module for Space-Track

Installation

$ pip install spacetrack

Example

>>> from spacetrack import SpaceTrackClient
>>> st = SpaceTrackClient('identity', 'password')

>>> print(st.gp(norad_cat_id=[25544, 41335], format='tle'))
1 25544U 98067A   16179.00000000  .00000000  00000-0  00000-0 0  0000
2 25544  00.0000   0.0000 0000000  00.0000 000.0000 00.00000000  0000
1 41335U 16011A   16179.00000000  .00000000  00000-0  00000-0 0  0000
2 41335  00.0000   0.0000 0000000  00.0000 000.0000 00.00000000  0000

>>> # Operators, to save manual string formatting.
>>> import spacetrack.operators as op
>>> from datetime import datetime
>>> drange = op.inclusive_range(datetime(2016, 6, 26), datetime(2016, 6, 27))

>>> # Streaming downloads line by line
>>> lines = st.gp_history(iter_lines=True, creation_date=drange, orderby='TLE_LINE1', format='tle')
>>> with open('tle.txt', 'w') as fp:
...     for line in lines:
...         fp.write(line)

>>> # Streaming downloads in chunk (note file is opened in binary mode)
>>> content = st.download(iter_content=True, file_id=..., format='stream')
>>> with open('file.txt', 'wb') as fp:
...     for chunk in content:
...         fp.write(chunk)

>>> # Parameter checking, using Space-Track's modeldef API
>>> st.gp(onrad_cat_id=25544)
TypeError: 'gp' got an unexpected argument 'onrad_cat_id'

>>> # Automatic rate limiting
>>> for satno in my_satnos:
...     # Gets limited to <30 requests per minute automatically by blocking
...     st.gp(...)

>>> # Log out and close connections
>>> st.close()

Authors

Documentation

For in-depth information, visit the documentation!

Development

spacetrack uses semantic versioning

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

spacetrack-1.4.0.tar.gz (44.7 kB view details)

Uploaded Source

Built Distribution

spacetrack-1.4.0-py3-none-any.whl (17.7 kB view details)

Uploaded Python 3

File details

Details for the file spacetrack-1.4.0.tar.gz.

File metadata

  • Download URL: spacetrack-1.4.0.tar.gz
  • Upload date:
  • Size: 44.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for spacetrack-1.4.0.tar.gz
Algorithm Hash digest
SHA256 fe4b54c3dede0496a0ecc4039211481a25ae4fbd0eff5e54190441f0d4434c74
MD5 acb2a24cfa960cbe392f51eb54c05e9d
BLAKE2b-256 0f81246faf20806cd112ee9f94102cf68f2a600c761f9fc83c36291b5da596a1

See more details on using hashes here.

Provenance

The following attestation bundles were made for spacetrack-1.4.0.tar.gz:

Publisher: python-publish.yml on python-astrodynamics/spacetrack

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file spacetrack-1.4.0-py3-none-any.whl.

File metadata

  • Download URL: spacetrack-1.4.0-py3-none-any.whl
  • Upload date:
  • Size: 17.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for spacetrack-1.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e693be354ee5a0b4f2205b2679049e0f709d8105c43d5a0ec0002e2f1a1d5e54
MD5 e4e74c8e4cc4d376bebc632f9d54fb8d
BLAKE2b-256 86917f6c8757549b80af2add458b00dbce72d57cbeff465398cf90836e108982

See more details on using hashes here.

Provenance

The following attestation bundles were made for spacetrack-1.4.0-py3-none-any.whl:

Publisher: python-publish.yml on python-astrodynamics/spacetrack

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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