ssactivewear_sdk.client¶
Interacting with S&S’ API.
Attributes¶
One identifier, or several. S&S takes several as a comma separated list. |
|
One date, or several. |
|
Classes¶
A class wrapping S&S' API. |
Functions¶
|
Normalize one or several identifiers into a list of strings. |
|
Build a resource path, with identifiers percent-encoded into the last segment. |
|
Build query parameters, dropping unset values and flags that are off. |
|
Format one or several dates the way S&S expects ( |
|
Format dates when given. |
|
Serialize a request, leaving unset fields to S&S' defaults. |
|
Return the response body. |
|
Unwrap a response that arrived as a list of lists. |
|
Pull the file name out of a |
|
Check your sku against the characters S&S allows. |
|
Build the exception for an error response. |
|
Parse an error body, if it is one. |
Module Contents¶
- type ssactivewear_sdk.client.Identifiers = Identifier | Iterable[Identifier][source]¶
One identifier, or several. S&S takes several as a comma separated list.
- ssactivewear_sdk.client._ORDER_SUBMISSION: pydantic.TypeAdapter[list[ssactivewear_sdk.models.Order] | ssactivewear_sdk.models.OrderSubmission][source]¶
- ssactivewear_sdk.client._PAYMENT_PROFILES: pydantic.TypeAdapter[list[ssactivewear_sdk.models.PaymentProfile] | list[list[ssactivewear_sdk.models.PaymentProfile]]][source]¶
- ssactivewear_sdk.client._TRACKING: pydantic.TypeAdapter[list[ssactivewear_sdk.models.TrackingData] | list[list[ssactivewear_sdk.models.TrackingData]]][source]¶
- class ssactivewear_sdk.client.SSActivewear(account_number: str, api_key: str, *, base_url: str = DEFAULT_BASE_URL, timeout: float = DEFAULT_TIMEOUT)[source]¶
A class wrapping S&S’ API.
- rate_limit_remaining: int | None = None[source]¶
Requests left in the current rate limit window, as of the last response.
- _make_request(method: str, path: str, params: dict[str, str] | None = None, json: dict[str, Any] | None = None) niquests.Response[source]¶
Make a request to S&S, raising for an error status.
- _get[T](path: str, adapter: pydantic.TypeAdapter[T], params: dict[str, str] | None = None) T[source]¶
GET a JSON resource and validate it.
- get_categories(category_ids: Identifiers | None = None) list[ssactivewear_sdk.models.Category][source]¶
Get every category, or only the categories with the given IDs.
- get_brands(brand_ids: Identifiers | None = None) list[ssactivewear_sdk.models.Brand][source]¶
Get every brand, or only the brands with the given IDs.
- get_styles(identifiers: Identifiers | None = None, *, search: str | None = None, style_ids: Identifiers | None = None, part_numbers: Identifiers | None = None) list[ssactivewear_sdk.models.Style][source]¶
Get styles.
- Parameters:
identifiers – Style IDs, part numbers, or
"{brand name} {style name}"names, e.g."Gildan 5000".search – Free text search, e.g.
"Gildan 2000".style_ids – Style IDs.
part_numbers – Part numbers (the first 5 digits of a sku).
- get_products(identifiers: Identifiers | None = None, *, styles: Identifiers | None = None, style_ids: Identifiers | None = None, part_numbers: Identifiers | None = None, warehouses: Identifiers | None = None) list[ssactivewear_sdk.models.Product][source]¶
Get products (skus) with pricing and stock.
With no filters this returns the entire catalog, which is very large.
- Parameters:
identifiers – Sku IDs, skus, GTINs, or your skus.
styles – Style IDs, part numbers, or
"{brand name} {style name}"names.style_ids – Style IDs.
part_numbers – Part numbers (the first 5 digits of a sku).
warehouses – Only report stock in these warehouses, e.g.
["IL", "KS"].
- get_inventory(identifiers: Identifiers | None = None, *, styles: Identifiers | None = None, style_ids: Identifiers | None = None, part_numbers: Identifiers | None = None, warehouses: Identifiers | None = None) list[ssactivewear_sdk.models.InventoryItem][source]¶
Get warehouse stock. Takes the same filters as
get_products()and returns far less data.
- get_specs(spec_ids: Identifiers | None = None, *, styles: Identifiers | None = None) list[ssactivewear_sdk.models.Spec][source]¶
Get spec sheet entries, by spec ID or by style (ID, part number, or
"{brand} {style}").
- get_orders(identifiers: Identifiers | None = None, *, include_invoiced: bool = False, invoice_dates: Dates | None = None, invoice_date_range: tuple[datetime.date, datetime.date] | None = None, shipping_label_barcode: str | None = None, lines: bool = False, boxes: bool = False, billing: bool = False, include_ar_child_invoices: bool = False, sort_by: Literal['linenumber', 'packing'] | None = None) list[ssactivewear_sdk.models.Order][source]¶
Get orders.
With no arguments this returns every order that has not been invoiced yet.
- Parameters:
identifiers – PO numbers, order numbers, invoice numbers, or order GUIDs.
include_invoiced – Also return invoiced orders from the last 3 months.
invoice_dates – Orders invoiced on these dates.
invoice_date_range – Orders invoiced between these two dates.
shipping_label_barcode – The order a shipping label belongs to (
{invoice number}.{box number}{lane}).lines – Include each order’s lines.
boxes – Include each order’s boxes.
billing – Include each order’s billing address.
include_ar_child_invoices – Also return orders for AR child accounts.
sort_by – Line order: by line number, or packing order (S&S’s default).
- create_order(order: ssactivewear_sdk.models.OrderRequest) ssactivewear_sdk.models.OrderSubmission[source]¶
Place an order.
S&S splits an order that ships from several warehouses into one order per warehouse.
- cancel_order(order_number: Identifier) list[ssactivewear_sdk.models.Order][source]¶
Cancel an order. S&S allows this up to 10 minutes after the order was placed.
Returns the orders that were cancelled.
- get_payment_profiles(email: str) list[ssactivewear_sdk.models.PaymentProfile][source]¶
Get the credit cards and bank accounts saved under a website user.
- get_invoice_pdf(invoice_number: Identifier) ssactivewear_sdk.models.InvoicePDF[source]¶
Get one invoice as a PDF.
- get_invoice_pdf_by_guid(guid: uuid.UUID | str) ssactivewear_sdk.models.InvoicePDF[source]¶
Get the invoice for an order GUID as a PDF.
- get_invoice_pdf_by_order_number(order_number: Identifier) ssactivewear_sdk.models.InvoicePDF[source]¶
Get every invoice for an order number, combined into one PDF.
- _get_pdf(path: str, params: dict[str, str] | None = None) ssactivewear_sdk.models.InvoicePDF[source]¶
GET a PDF document.
- get_returns(identifiers: Identifiers | None = None, *, invoice_dates: Dates | None = None, lines: bool = False, boxes: bool = False) list[ssactivewear_sdk.models.ReturnOrder][source]¶
Get return and replacement orders.
- Parameters:
identifiers – PO numbers (of the original order), order numbers, invoice numbers, or order GUIDs.
invoice_dates – Returns invoiced on these dates.
lines – Include each order’s lines.
boxes – Include each order’s boxes.
- create_return(request: ssactivewear_sdk.models.ReturnRequest) list[ssactivewear_sdk.models.ReturnOrder][source]¶
Request a return.
Depending on the return and whether replacements were asked for, S&S may create both a credit order and a replacement order.
- cancel_return(order_number: Identifier) list[ssactivewear_sdk.models.ReturnOrder][source]¶
Cancel a return. S&S allows this up to 10 minutes after the return was requested.
Returns the orders that were cancelled.
- get_cross_references(your_skus: Identifiers | None = None) list[ssactivewear_sdk.models.CrossReference][source]¶
Get every sku you have mapped to your own sku, or only the given ones.
- set_cross_reference(your_sku: str, identifier: Identifier) bool[source]¶
Map your sku to an S&S sku (sku ID, sku, or GTIN), replacing any existing mapping.
Returns
Trueif the mapping was created andFalseif an existing one was updated.
- get_days_in_transit(zip_codes: Identifiers | None = None) list[ssactivewear_sdk.models.DaysInTransit][source]¶
Get cutoff times and days in transit from each warehouse, for every ZIP code or only the given ones.
- get_all_tracking(*, boxes: bool = False) list[ssactivewear_sdk.models.TrackingData][source]¶
Get tracking data for every shipment.
- get_tracking_by_invoice(invoice_numbers: Identifiers, *, boxes: bool = False) list[ssactivewear_sdk.models.TrackingData][source]¶
Get tracking data for invoice numbers.
- get_tracking_by_order_number(order_numbers: Identifiers, *, boxes: bool = False) list[ssactivewear_sdk.models.TrackingData][source]¶
Get tracking data for order numbers.
- get_tracking_by_tracking_number(tracking_numbers: Identifiers, *, boxes: bool = False) list[ssactivewear_sdk.models.TrackingData][source]¶
Get tracking data for tracking numbers.
- get_tracking_by_ship_date(ship_dates: Dates, *, boxes: bool = False) list[ssactivewear_sdk.models.TrackingData][source]¶
Get tracking data for shipments that shipped on the given dates.
- get_tracking_by_ship_date_range(start: datetime.date, end: datetime.date, *, boxes: bool = False) list[ssactivewear_sdk.models.TrackingData][source]¶
Get tracking data for shipments that shipped between two dates.
- ssactivewear_sdk.client._identifier_list(identifiers: Identifiers) list[str][source]¶
Normalize one or several identifiers into a list of strings.
- ssactivewear_sdk.client._path(resource: str, identifiers: Identifiers | None = None) str[source]¶
Build a resource path, with identifiers percent-encoded into the last segment.
- ssactivewear_sdk.client._query(**values: Identifiers | bool | None) dict[str, str][source]¶
Build query parameters, dropping unset values and flags that are off.
- ssactivewear_sdk.client._date_list(dates: Dates) list[str][source]¶
Format one or several dates the way S&S expects (
yyyy-MM-dd).
- ssactivewear_sdk.client._dates_or_none(dates: Dates | None) list[str] | None[source]¶
Format dates when given.
- ssactivewear_sdk.client._request_body(model: ssactivewear_sdk.models._base.SSActivewearBaseModel) dict[str, Any][source]¶
Serialize a request, leaving unset fields to S&S’ defaults.
- ssactivewear_sdk.client._content(response: niquests.Response) bytes[source]¶
Return the response body.
- ssactivewear_sdk.client._flatten[ModelT: ssactivewear_sdk.models._base.SSActivewearBaseModel](items: list[ModelT] | list[list[ModelT]]) list[ModelT][source]¶
Unwrap a response that arrived as a list of lists.
- ssactivewear_sdk.client._attachment_filename(content_disposition: str | None) str | None[source]¶
Pull the file name out of a
Content-Dispositionheader.
- ssactivewear_sdk.client._validate_your_sku(your_sku: str) None[source]¶
Check your sku against the characters S&S allows.
- ssactivewear_sdk.client._api_error(response: niquests.Response) ssactivewear_sdk.exceptions.SSActivewearAPIError[source]¶
Build the exception for an error response.
- ssactivewear_sdk.client._parse_error(content: bytes) ssactivewear_sdk.models.ErrorResponse | None[source]¶
Parse an error body, if it is one.