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.tle_latest(norad_cat_id=[25544, 41335], ordinal=1, 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
>>> drange = op.inclusive_range(dt.datetime(2016, 6, 26),
...                             dt.datetime(2016, 6, 27))

>>> # Streaming downloads line by line
>>> lines = st.tle_publish(iter_lines=True, publish_epoch=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.tle_latest(norad_cat_id=25544)
TypeError: 'tle_latest' got an unexpected argument 'onrad_cat_id'

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

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.3.1.tar.gz (27.4 kB view details)

Uploaded Source

Built Distribution

spacetrack-1.3.1-py3-none-any.whl (15.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: spacetrack-1.3.1.tar.gz
  • Upload date:
  • Size: 27.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.0 CPython/3.12.4

File hashes

Hashes for spacetrack-1.3.1.tar.gz
Algorithm Hash digest
SHA256 9d26fca0948b7affae5767148c333d13c97eef33a25dcd1a49312f4fe51b87af
MD5 fd6a7488066220437a95c911a498c8e4
BLAKE2b-256 0e57e0fa6e276e6fb3d121462ca8cca622dc148ae33f8f5ee1935352a9cd1705

See more details on using hashes here.

Provenance

File details

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

File metadata

  • Download URL: spacetrack-1.3.1-py3-none-any.whl
  • Upload date:
  • Size: 15.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.0 CPython/3.12.4

File hashes

Hashes for spacetrack-1.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 4c4470a922156259216bf838a69790aea11878d1717dad397bff7f26774445cc
MD5 1c8ed35cc707fdf2cda8bc85e71472af
BLAKE2b-256 4c5402cf36b3f4f9f8d77a858f38c3a7deb227d99d91efcd0d78efaf8a0bab6c

See more details on using hashes here.

Provenance

Supported by

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