README.rst
1spacetrack
2-------------
3
4|PyPI Version| |Documentation| |CI Status| |Coverage| |Python Version| |MIT License|
5
6spacetrack is a python module for `Space-Track <https://www.space-track.org>`__
7
8Installation
9~~~~~~~~~~~~
10
11.. code:: bash
12
13 $ pip install spacetrack
14
15Example
16~~~~~~~
17
18.. code:: python
19
20 >>> from spacetrack import SpaceTrackClient
21 >>> st = SpaceTrackClient('identity', 'password')
22
23 >>> print(st.tle_latest(norad_cat_id=[25544, 41335], ordinal=1, format='tle'))
24 1 25544U 98067A 16179.00000000 .00000000 00000-0 00000-0 0 0000
25 2 25544 00.0000 0.0000 0000000 00.0000 000.0000 00.00000000 0000
26 1 41335U 16011A 16179.00000000 .00000000 00000-0 00000-0 0 0000
27 2 41335 00.0000 0.0000 0000000 00.0000 000.0000 00.00000000 0000
28
29 >>> # Operators, to save manual string formatting.
30 >>> import spacetrack.operators as op
31 >>> drange = op.inclusive_range(dt.datetime(2016, 6, 26),
32 ... dt.datetime(2016, 6, 27))
33
34 >>> # Streaming downloads line by line
35 >>> lines = st.tle(iter_lines=True, publish_epoch=drange, orderby='TLE_LINE1', format='tle')
36 >>> with open('tle.txt', 'w') as fp:
37 ... for line in lines:
38 ... fp.write(line)
39
40 # Streaming downloads in chunk (note file is opened in binary mode)
41 >>> content = st.download(iter_content=True, file_id=..., format='stream')
42 >>> with open('file.txt', 'wb') as fp:
43 ... for chunk in content:
44 ... fp.write(chunk)
45
46 >>> # Parameter checking, using Space-Track's modeldef API
47 >>> st.tle_latest(onrad_cat_id=25544)
48 TypeError: 'tle_latest' got an unexpected argument 'onrad_cat_id'
49
50 >>> # Automatic rate limiting
51 >>> for satno in my_satnos:
52 ... # Gets limited to <20 requests per minute automatically by blocking
53 ... st.tle(...)
54
55Authors
56~~~~~~~
57- Frazer McLean <frazer@frazermclean.co.uk>
58
59Documentation
60~~~~~~~~~~~~~
61
62For in-depth information, `visit the
63documentation <http://spacetrack.readthedocs.org/en/latest/>`__!
64
65Development
66~~~~~~~~~~~
67
68spacetrack uses `semantic versioning <http://semver.org>`__
69
70.. |CI Status| image:: https://github.com/python-astrodynamics/spacetrack/workflows/CI/badge.svg?branch=master
71 :target: https://github.com/python-astrodynamics/spacetrack/actions?workflow=CI
72.. |PyPI Version| image:: http://img.shields.io/pypi/v/spacetrack.svg?style=flat-square
73 :target: https://pypi.python.org/pypi/spacetrack/
74.. |Python Version| image:: https://img.shields.io/badge/python-3.6%2B-brightgreen.svg?style=flat-square
75 :target: https://www.python.org/downloads/
76.. |MIT License| image:: http://img.shields.io/badge/license-MIT-blue.svg?style=flat-square
77 :target: https://raw.githubusercontent.com/python-astrodynamics/spacetrack/master/LICENSE.txt
78.. |Coverage| image:: https://img.shields.io/codecov/c/github/python-astrodynamics/spacetrack/master.svg?style=flat-square
79 :target: https://codecov.io/github/python-astrodynamics/spacetrack?branch=master
80.. |Documentation| image:: https://img.shields.io/badge/docs-latest-brightgreen.svg?style=flat-square
81 :target: http://spacetrack.readthedocs.org/en/latest/
82