SpaceTrackClient¶
SpaceTrackClient ¶
SpaceTrackClient(identity: str, password: str, base_url: str = None, rate_limit: RateLimitConfig = None)
SpaceTrack API client with session-based authentication.
Handles authentication and query execution against Space-Track.org. Lazily authenticates on first query and re-authenticates on session expiry.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
identity | str | Space-Track.org login email. | required |
password | str | Space-Track.org password. | required |
base_url | str | Custom base URL for testing. | None |
rate_limit | RateLimitConfig | Rate limit configuration. Defaults to 25 requests/minute, 250 requests/hour. | None |
Example
Initialize instance.
authenticate method descriptor ¶
authenticate() -> Any
Explicitly authenticate with Space-Track.org.
Called automatically on first query. Call explicitly to verify credentials early.
Raises:
| Type | Description |
|---|---|
BraheError | If authentication fails. |
fileshare_delete method descriptor ¶
fileshare_download method descriptor ¶
fileshare_download_folder method descriptor ¶
Download all files in a folder from the Space-Track file share.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
folder_id | str | Folder identifier to download. | required |
Returns:
| Name | Type | Description |
|---|---|---|
bytes | bytes | Folder content as bytes (typically a zip archive). |
Raises:
| Type | Description |
|---|---|
BraheError | On network, auth, or download errors. |
fileshare_list_files method descriptor ¶
fileshare_list_files() -> list[FileShareFileRecord]
List files in the Space-Track file share.
Returns:
| Type | Description |
|---|---|
list[FileShareFileRecord] | list[FileShareFileRecord]: File metadata records. |
Raises:
| Type | Description |
|---|---|
BraheError | On network, auth, or parse errors. |
fileshare_list_folders method descriptor ¶
fileshare_list_folders() -> list[FolderRecord]
List folders in the Space-Track file share.
Returns:
| Type | Description |
|---|---|
list[FolderRecord] | list[FolderRecord]: Folder metadata records. |
Raises:
| Type | Description |
|---|---|
BraheError | On network, auth, or parse errors. |
fileshare_upload method descriptor ¶
Upload a file to the Space-Track file share.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
folder_id | str | Target folder identifier. | required |
file_name | str | Name for the uploaded file. | required |
file_data | bytes | File content as bytes. | required |
Returns:
| Name | Type | Description |
|---|---|---|
str | str | Server response (typically JSON confirmation). |
Raises:
| Type | Description |
|---|---|
BraheError | On network, auth, or upload errors. |
publicfiles_download method descriptor ¶
publicfiles_list_dirs method descriptor ¶
query_gp method descriptor ¶
query_gp(query: SpaceTrackQuery) -> list[GPRecord]
Execute a GP query and return typed GP records.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
query | SpaceTrackQuery | The query to execute (must use JSON format). | required |
Returns:
| Type | Description |
|---|---|
list[GPRecord] | list[GPRecord]: List of typed GP records. |
Raises:
| Type | Description |
|---|---|
BraheError | On network, auth, parse, or format errors. |
query_json method descriptor ¶
query_json(query: SpaceTrackQuery) -> list[dict]
Execute a query and return parsed JSON values.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
query | SpaceTrackQuery | The query to execute (must use JSON format). | required |
Returns:
| Type | Description |
|---|---|
list[dict] | list[dict]: List of JSON objects. |
Raises:
| Type | Description |
|---|---|
BraheError | On network, auth, parse, or format errors. |
query_raw method descriptor ¶
query_raw(query: SpaceTrackQuery) -> str
Execute a query and return the raw response body as a string.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
query | SpaceTrackQuery | The query to execute. | required |
Returns:
| Name | Type | Description |
|---|---|---|
str | str | Raw response body. |
Raises:
| Type | Description |
|---|---|
BraheError | On network, auth, or HTTP errors. |
query_satcat method descriptor ¶
query_satcat(query: SpaceTrackQuery) -> list[SATCATRecord]
Execute a SATCAT query and return typed SATCAT records.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
query | SpaceTrackQuery | The query to execute (must use JSON format). | required |
Returns:
| Type | Description |
|---|---|
list[SATCATRecord] | list[SATCATRecord]: List of typed SATCAT records. |
Raises:
| Type | Description |
|---|---|
BraheError | On network, auth, parse, or format errors. |
spephemeris_download method descriptor ¶
spephemeris_file_history method descriptor ¶
spephemeris_list_files method descriptor ¶
spephemeris_list_files() -> list[SPEphemerisFileRecord]
List available SP ephemeris files.
Returns:
| Type | Description |
|---|---|
list[SPEphemerisFileRecord] | list[SPEphemerisFileRecord]: Ephemeris file metadata records. |
Raises:
| Type | Description |
|---|---|
BraheError | On network, auth, or parse errors. |
See Also¶
- Client Guide -- Authentication and query execution patterns
- SpaceTrackQuery -- Building queries to pass to the client
- Response Types -- GPRecord, SATCATRecord, FileShareFileRecord, FolderRecord, and SPEphemerisFileRecord
- File Operations Guide -- FileShare, SP Ephemeris, and Public Files