Async API

class spacetrack.aio.AsyncSpaceTrackClient(identity, password, base_url='', rush_store=None, rush_key_prefix='', httpx_client=None, additional_rate_limit=None)[source]

Bases: SpaceTrackClient

Asynchronous SpaceTrack client class.

It must be closed by calling close(). Alternatively, instances of this class can be used as an async context manager.

Refer to the SpaceTrackClient documentation for more information. Note that if passed, the httpx_client parameter must be an httpx.AsyncClient.

async authenticate()[source]

Authenticate with Space-Track.


spacetrack.base.AuthenticationError – Incorrect login details.


This method is called automatically when required.

async generic_request(class_, iter_lines=False, iter_content=False, controller=None, parse_types=False, **kwargs)[source]

Generic Space-Track query.

The request class methods use this method internally; the public API is as follows:

st.tle_publish(*args, **kw)
st.basicspacedata.tle_publish(*args, **kw)
st.file(*args, **kw)
st.fileshare.file(*args, **kw)
st.spephemeris.file(*args, **kw)

They resolve to the following calls respectively:

st.generic_request('tle_publish', *args, **kw)
st.generic_request('tle_publish', *args, controller='basicspacedata', **kw)
st.generic_request('file', *args, **kw)
st.generic_request('file', *args, controller='fileshare', **kw)
st.generic_request('file', *args, controller='spephemeris', **kw)
  • class_ – Space-Track request class name

  • iter_lines – Yield result line by line

  • iter_content – Yield result in 100 KiB chunks.

  • controller – Optionally specify request controller to use.

  • parse_types – Parse string values in response according to type given in predicate information, e.g. '2017-01-01' ->, 1, 1).

  • **kwargs

    These keywords must match the predicate fields on Space-Track. You may check valid keywords with the following snippet:

    spacetrack = SpaceTrackClient(...)
    # or

    See _stringify_predicate_value() for which Python objects are converted appropriately.


Lines—stripped of newline characters—if iter_lines=True


100 KiB chunks if iter_content=True


Parsed JSON object, unless format keyword argument is passed.


Passing format='json' will return the JSON unparsed. Do not set format if you want the parsed JSON object returned!

async get_predicates(class_, controller=None)[source]

Get full predicate information for given request class, and cache for subsequent calls.

async close()[source]

Close aiohttp session.