spacetrack
is a Pythonic client implementation for Space-Track. Further examples can be found in the usage section of the documentation.
import spacetrack.operators as op
from spacetrack import SpaceTrackClient
st = SpaceTrackClient(identity='user@example.com', password='password')
data = st.tle_latest(
iter_lines=True,
ordinal=1,
epoch='>now-30',
mean_motion=op.inclusive_range(0.99, 1.01),
eccentricity=op.less_than(0.01),
format='tle',
)
with open('tle_latest.txt', 'w') as fp:
for line in data:
fp.write(line + '\n')