sanmar_sdk¶
A typed Python SDK for SanMar’s web services and SFTP data files.
Submodules¶
Attributes¶
A warehouse number as SanMar reports it. |
Exceptions¶
SanMar rejected the credentials. |
|
The account is not authorized to use this service (PromoStandards code 104). |
|
A SanMar data file did not have the layout the SDK expects. |
|
SanMar has no record matching the request. |
|
SanMar rejected the request as malformed or out of range. |
|
SanMar's response could not be parsed, or did not match its own WSDL. |
|
SanMar could not be reached, or answered with an HTTP error status. |
|
Base class for every error the SDK raises. |
|
SanMar reported an error for the request. |
|
SanMar answered with a SOAP fault. |
Classes¶
A client for SanMar's web services, both SanMar's own and PromoStandards. |
|
Which of SanMar's two web service environments to call. |
|
How SanMar ships an order. |
|
Where an order ships. |
|
SanMar's own key for one style, color and size. |
|
One style, color and size, named the way SanMar's order services expect. |
|
A style to look up, optionally narrowed to one catalog color, one size, or both. |
|
A SanMar warehouse, numbered as SanMar numbers them. |
|
Pick an order up from a warehouse instead of having it shipped. |
Package Contents¶
- class sanmar_sdk.SanMar(customer_number: int, username: str, password: str, *, environment: sanmar_sdk.common.Environment = Environment.PRODUCTION, timeout: float = 30.0, transport: zeep.Transport | None = None)[source]¶
A client for SanMar’s web services, both SanMar’s own and PromoStandards.
- Parameters:
customer_number – The SanMar customer number. SanMar’s own services require it; PromoStandards services do not use it.
username – A SanMar.com login. Create one at https://www.sanmar.com/signup/webuser, then ask sanmarintegrations@sanmar.com to enable web service access. EDEV logins are separate from production ones, and neither works on SanMar’s SFTP server.
password – A SanMar.com login. Create one at https://www.sanmar.com/signup/webuser, then ask sanmarintegrations@sanmar.com to enable web service access. EDEV logins are separate from production ones, and neither works on SanMar’s SFTP server.
environment – Production, or SanMar’s EDEV test environment.
timeout – Seconds to wait for a WSDL to load or a call to finish.
transport – A zeep
Transportto use instead of the default one, for example to cache WSDLs or go through a proxy. It is used as-is, sotimeoutdoes not apply.
- property environment: sanmar_sdk.common.Environment[source]¶
The environment this client calls.
- class sanmar_sdk.Environment[source]¶
Bases:
enum.StrEnumWhich of SanMar’s two web service environments to call.
- EDEV = 'https://edev-ws.sanmar.com:8080'[source]¶
SanMar’s test environment. It needs its own credentials, requested from sanmarintegrations@sanmar.com, and its products, prices and inventory may not match production.
- class sanmar_sdk.ShipMethod[source]¶
Bases:
enum.StrEnumHow SanMar ships an order.
The value is the ship method as SanMar’s own order services and order files spell it. PromoStandards orders split it into a carrier and a service; see
promostandards_freight().- PSST = 'PSST'[source]¶
SanMar’s Pack Separately, Ship Together program. The ship-to must exactly match the address SanMar has on file.
- class sanmar_sdk.ShipTo(/, **data: Any)[source]¶
Bases:
sanmar_sdk.base.ModelWhere an order ships.
Field lengths are the tightest limits across SanMar’s order services and order files.
- address1: Annotated[str, Field(min_length=1, max_length=35), sanmar_sdk.base.ORDER_TEXT][source]¶
The street address. SanMar asks for the abbreviations ST, AVE, RD, DR and BLVD.
- city: Annotated[str, Field(min_length=1, max_length=28), sanmar_sdk.base.ORDER_TEXT][source]¶
- company: Annotated[str, Field(min_length=1, max_length=28), sanmar_sdk.base.ORDER_TEXT] | None = None[source]¶
- attention: Annotated[str, Field(min_length=1, max_length=35), sanmar_sdk.base.ORDER_TEXT] | None = None[source]¶
The receiver’s name, or the PO number.
- address2: Annotated[str, Field(min_length=1, max_length=35), sanmar_sdk.base.ORDER_TEXT] | None = None[source]¶
The suite or apartment number.
- email: Annotated[str, Field(min_length=3, max_length=105), sanmar_sdk.base.ORDER_TEXT] | None = None[source]¶
Where SanMar sends the order confirmation and shipping notification.
When omitted, SanMar uses the default email on the account.
- phone: Annotated[str, Field(min_length=1, max_length=32), sanmar_sdk.base.ORDER_TEXT] | None = None[source]¶
The receiver’s phone number. Only PromoStandards orders carry it.
- class sanmar_sdk.SkuKey(/, **data: Any)[source]¶
Bases:
sanmar_sdk.base.ModelSanMar’s own key for one style, color and size.
INVENTORY_KEYandSIZE_INDEXare in every SanMar product file. The inventory key is not the style number. SanMar recommends ordering by key rather than by style, color and size, because it cannot be misspelled.
- class sanmar_sdk.StyleColorSize(/, **data: Any)[source]¶
Bases:
sanmar_sdk.base.ModelOne style, color and size, named the way SanMar’s order services expect.
- class sanmar_sdk.StyleQuery(/, **data: Any)[source]¶
Bases:
sanmar_sdk.base.ModelA style to look up, optionally narrowed to one catalog color, one size, or both.
- class sanmar_sdk.Warehouse[source]¶
Bases:
enum.IntEnumA SanMar warehouse, numbered as SanMar numbers them.
The number is also the warehouse’s PromoStandards FOB id.
- sanmar_sdk.WarehouseNumber[source]¶
A warehouse number as SanMar reports it.
A known warehouse parses to
Warehouse. A number SanMar has added since this SDK was released stays a plainintrather than failing the whole response.
- class sanmar_sdk.WillCall(/, **data: Any)[source]¶
Bases:
sanmar_sdk.base.ModelPick an order up from a warehouse instead of having it shipped.
Only SanMar’s own order services and order files support will call, and only for accounts SanMar has set up for warehouse selection.
- exception sanmar_sdk.AuthenticationError(message: str, code: int | None = None)[source]¶
Bases:
ServiceErrorSanMar rejected the credentials.
Web services use a SanMar.com username and password (plus the customer number for SanMar’s own services). EDEV has separate credentials from production, and the SFTP server has its own password.
- exception sanmar_sdk.AuthorizationError(message: str, code: int | None = None)[source]¶
Bases:
ServiceErrorThe account is not authorized to use this service (PromoStandards code 104).
- exception sanmar_sdk.FileFormatError(message: str, line_number: int | None = None)[source]¶
Bases:
SanMarErrorA SanMar data file did not have the layout the SDK expects.
- exception sanmar_sdk.NotFoundError(message: str, code: int | None = None)[source]¶
Bases:
ServiceErrorSanMar has no record matching the request.
- exception sanmar_sdk.RequestError(message: str, code: int | None = None)[source]¶
Bases:
ServiceErrorSanMar rejected the request as malformed or out of range.
- exception sanmar_sdk.ResponseError[source]¶
Bases:
SanMarErrorSanMar’s response could not be parsed, or did not match its own WSDL.
- exception sanmar_sdk.SanMarConnectionError[source]¶
Bases:
SanMarErrorSanMar could not be reached, or answered with an HTTP error status.
SanMar’s web services listen on port 8080, which some networks block outright.
- exception sanmar_sdk.SanMarError[source]¶
Bases:
ExceptionBase class for every error the SDK raises.