shipstation_sdk.client

Interacting with ShipStation.

Attributes

Classes

ShipStationClient

A class wrapping ShipStation API v2 interaction.

Functions

_retry_after_seconds(→ float)

Determine how long to sleep before retrying a rate-limited request.

Module Contents

shipstation_sdk.client.RETRY_ATTEMPTS = 3[source]
shipstation_sdk.client.DEFAULT_RETRY_AFTER_SECONDS = 5.0[source]
shipstation_sdk.client.MAX_RETRY_AFTER_SECONDS = 60.0[source]
shipstation_sdk.client._retry_after_seconds(response: niquests.Response) float[source]

Determine how long to sleep before retrying a rate-limited request.

Parameters:

response – The 429 response, whose Retry-After header is honored in either RFC 9110 form – delta-seconds or an HTTP-date – capped at MAX_RETRY_AFTER_SECONDS.

class shipstation_sdk.client.ShipStationClient(api_key: str, base_url: str = 'https://api.shipstation.com', timeout: float = 60.0)[source]

A class wrapping ShipStation API v2 interaction.

session[source]
make_request(method: str, path: str, params: dict[str, Any] | None = None, json: dict[str, Any] | None = None) niquests.Response[source]

Make a request to ShipStation, retrying when rate-limited.

Retries up to RETRY_ATTEMPTS total attempts on HTTP 429, sleeping the response’s Retry-After (DEFAULT_RETRY_AFTER_SECONDS when absent).

list_shipments(parameters: shipstation_sdk.parameters.ShipmentListParameters | None = None) shipstation_sdk.models.ShipmentsList[source]

Get a page of shipments.

iter_shipments(parameters: shipstation_sdk.parameters.ShipmentListParameters | None = None) collections.abc.Iterator[shipstation_sdk.models.Shipment][source]

Iterate over every shipment matching the parameters, following pagination.

get_shipment(shipment_id: str) shipstation_sdk.models.Shipment[source]

Get a specific shipment.

get_shipment_by_external_id(external_shipment_id: str) shipstation_sdk.models.Shipment[source]

Get a specific shipment by the external shipment ID it was created with.

External shipment IDs are caller-defined and may contain URL metacharacters (e.g. marketplace IDs like gid://...), so the path segment is escaped.

list_carriers() shipstation_sdk.models.CarriersList[source]

Get the connected carrier accounts.

list_tags() shipstation_sdk.models.TagsList[source]

Get the tags defined on the account.