darbiadev_ups.ups_services ========================== .. py:module:: darbiadev_ups.ups_services .. autoapi-nested-parse:: UPSServices. Classes ------- .. autoapisummary:: darbiadev_ups.ups_services._AuthType darbiadev_ups.ups_services.UPSServices Module Contents --------------- .. py:class:: _AuthType(*args, **kwds) Bases: :py:obj:`enum.Enum` An enum for the authentication types. .. py:attribute:: HEADERS .. py:attribute:: JSON .. py:class:: UPSServices(base_url: str, username: str, password: str, access_license_number: str) A class wrapping UPS' API. .. py:attribute:: TRACKING_REGEX :type: Final[str] :value: '1Z[A-Z0-9]{6}[0-9]{10}' .. py:attribute:: TRACKING_URL :type: Final[str] :value: 'https://wwwapps.ups.com/WebTracking/processInputRequest?TypeOfInquiryNumber=T&InquiryNumber1={tr... .. py:attribute:: base_url :type: str .. py:attribute:: __username :type: str .. py:attribute:: __password :type: str .. py:attribute:: __access_license_number :type: str .. py:method:: __auth_headers() -> dict[str, str] Return authentication headers as a dictionary. .. py:method:: __auth_dict() -> dict[str, dict[str, dict[str, str]]] Return authentication JSON as a dictionary. .. py:method:: make_request(method: str, auth_type: _AuthType, service: str, data: dict[str, Any], timeout: int = 500) -> dict Make a request to UPS' API. .. py:method:: track(tracking_number: str) -> dict Get tracking details for a tracking number. .. py:method:: validate_address(street_lines: list[str], city: str, state: str, postal_code: str, country: str) -> dict[str, str] Validate an address. .. py:method:: 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, pickup_date: str | None = None) -> dict[str, str | list[dict[str, str]]] Estimate transit time.