SpaceTrack

exception spacetrack.base.AuthenticationError[source]

Space-Track authentication error.

class spacetrack.base.Predicate(name, type_, nullable=False, default=None, values=None)[source]

Hold Space-Track predicate information.

The current goal of this class is to print the repr for the user.

class spacetrack.base.SpaceTrackClient(identity, password)[source]

SpaceTrack client class.

Parameters:
  • identity – Space-Track username.
  • password – Space-Track password.

For more information, refer to the Space-Track documentation.

authenticate()[source]

Authenticate with Space-Track.

Raises:spacetrack.base.AuthenticationError – Incorrect login details.
generic_request(class_, iter_lines=False, iter_content=False, **kwargs)[source]

Generic Space-Track query.

The request class methods use this method internally; the following two lines are equivalent:

spacetrack.tle_publish(*args, **kwargs)
spacetrack.generic_request('tle_publish', *args, **kwargs)
Parameters:
  • class – Space-Track request class name
  • iter_lines – Yield result line by line
  • iter_content – Yield result in 100 KiB chunks.
  • **kwargs

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

    spacetrack = SpaceTrackClient(...)
    spacetrack.tle.get_predicates()
    # or
    spacetrack.get_predicates('tle')
    

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

Yields:

Lines—stripped of newline characters—if iter_lines=True

Yields:

100 KiB chunks if iter_content=True

Returns:

Parsed JSON object, unless format keyword argument is passed.

Warning

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

get_predicates(class_)[source]

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