Address Standardization
Project description
Pigeonly Address
For standardizing addresses.
For more information on USPS API keys and terms, see here
Installation
pip install pigeonly-address
Example Usage
from pigeonly_address import AddressService, StandardizeAddressError
# Example usage
try:
address = {
"name": "aj patel",
"line_one": "5 reynolds",
"line_two": "#3",
"city": "New bedford",
"governing_district": "MA",
"postal_code": "02744",
"country": "USA"
}
standardized_addr = AddressService("USPS_API_KEY").standardize_address(**address)
print(standardized_addr)
# Example success
# {
# "name": "AJ PATEL",
# "line_one": "5 REYNOLDS ST",
# "line_two": "APT 3",
# "city": "NEW BEDFORD",
# "governing_district": "MA",
# "postal_code": "02740",
# "country": "US",
# "meta": None
# }
# ------------------------------------------
# A `meta` field is also returned.
# Usually meta is None.
# But sometimes, like if an address is correct,
# but the address apt # is not verified,
# a message returns => meta["message"]
meta = standardized_addr.pop("meta")
if meta and meta.get("message"):
print(meta["message"])
except StandardizeAddressError as e:
# Example str(e) == "Address Not Found"
print(e)
USPS Docs
For US Addresses, it uses the USPS API when possible.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pigeonly-address-0.0.1.tar.gz
(6.1 kB
view hashes)
Built Distribution
Close
Hashes for pigeonly_address-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 37e67166361b521b7ebfcddd219e5216756ff0add67c35c2bab108677e8dd3b9 |
|
MD5 | cf8f1a57c53eb75ba51386176a4ab98f |
|
BLAKE2b-256 | 9c0bec18689918a3d4358f82452cf065788a16750306709311685174126bb058 |