Python client for space-track.org
Project description
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(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(onrad_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(...)
Documentation
For in-depth information, visit the documentation!
Development
spacetrack uses semantic versioning
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
spacetrack-0.15.0.tar.gz
(27.5 kB
view hashes)
Built Distribution
Close
Hashes for spacetrack-0.15.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1649269070b57633786a9f94364bea234a2c1f41540a2580e046f3c0ebd9dda6 |
|
MD5 | dcfc4d81b3b5c52de5911c5677116537 |
|
BLAKE2b-256 | eb8e23a28ba9dd31fdced4c2feb7ba7747c80e92a3a917798264d3472fd7aba4 |