Skip to main content
Help the Python Software Foundation raise $60,000 USD by December 31st!  Building the PSF Q4 Fundraiser

An unofficial client for the USPS Web Tools APIs

Project description

usps-client

CircleCI Known Vulnerabilities

Python client for the USPS Web Tools API.

Usage

Import the client, instantiate with your user id (register at https://registration.shippingapis.com/) and call the standardize method:

>>> import usps_client
>>> usps = usps_client.Client('[your user id]')
>>> standardized = usps.standardize_address(
...     firm_name="USPS Office of the Consumer Advocate",
...     address1="475 LENFANT PLZ SW RM 4012",
...     city="Washington",
...     state="DC",
...     zip5="20260",
... )

An Address object will be returned, containing data returned from the USPS Web Tools API.

Since the return classes are defined using the attrs model, it is possible to convert into generic types:

>>> import attr
>>> attr.asdict(standardized)
{'firm_name': 'USPS OFFICE OF THE CONSUMER ADVOCATE', 'address1': None, 'address2': '475 LENFANT PLZ SW RM 4012', 'city': 'WASHINGTON', 'state': 'DC', 'zip5': '20260', 'zip4': '0004'}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for usps-client, version 0.2
Filename, size File type Python version Upload date Hashes
Filename, size usps_client-0.2-py3-none-any.whl (7.7 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size usps-client-0.2.tar.gz (5.4 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page