darbiadev_shipping.shipping_services#

shipping_services.

Module Contents#

Classes#

CarrierEnum

An enum of shipping carriers.

Carrier

A shipping carrier.

CarrierRegistrar

A registrar for carriers.

ShippingServices

A class wrapping multiple shipping carrier API wrapping packages, providing a common interface.

class darbiadev_shipping.shipping_services.CarrierEnum(*args, **kwds)[source]#

Bases: enum.Enum

An enum of shipping carriers.

UPS[source]#
FEDEX[source]#
USPS[source]#
class darbiadev_shipping.shipping_services.Carrier(name: str, client_package: str, client_class: str, auth_dict: dict[str, str])[source]#

A shipping carrier.

class darbiadev_shipping.shipping_services.CarrierRegistrar[source]#

A registrar for carriers.

register_carrier(carrier_enum: CarrierEnum, name: str, client_package: str, client_class: str, auth_dict: dict[str, str] | None) None[source]#

Register carrier in the registrar.

class darbiadev_shipping.shipping_services.ShippingServices(ups_auth: dict[str, str] | None = None, fedex_auth: dict[str, str] | None = None, usps_auth: dict[str, str] | None = None)[source]#

A class wrapping multiple shipping carrier API wrapping packages, providing a common interface.

_get_carrier_from_registrar(carrier_enum: CarrierEnum | None = None) Carrier[source]#

Get a carrier from the registrar.

guess_carrier(tracking_number: str) CarrierEnum | None[source]#

Guess which carrier a tracking number belongs to.

Parameters:

tracking_number – The tracking number to guess a carrier for.

Returns:

The carrier the tracking number belongs to.

Return type:

CarrierEnum|None

track(tracking_number: str, carrier_enum: CarrierEnum | None = None) dict[source]#

Get details for tracking number.

validate_address(street_lines: list[str], city: str, state: str, postal_code: str, country: str, carrier_enum: CarrierEnum | None = None) dict[source]#

Validate an address.

time_in_transit(from_state: str, from_postal_code: str, from_country: str, to_state: str, to_postal_code: str, to_country: str, weight: str, carrier_enum: CarrierEnum | None = None) dict[source]#

Get estimated time in transit information.