Skip to main content

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


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 details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pigeonly_address-0.0.1-py3-none-any.whl (6.7 kB view details)

Uploaded Python 3

File details

Details for the file pigeonly-address-0.0.1.tar.gz.

File metadata

  • Download URL: pigeonly-address-0.0.1.tar.gz
  • Upload date:
  • Size: 6.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.9.12

File hashes

Hashes for pigeonly-address-0.0.1.tar.gz
Algorithm Hash digest
SHA256 b9bf20e1887c23fe4336b31c60a00a23875f72af0832df301d4ababe35189f53
MD5 b244089fa9b926ea7663275de448e9cd
BLAKE2b-256 e64e950ec0203e411ac02913a11100977b3e220d4fad8fa197fc4ea33ac7136e

See more details on using hashes here.

File details

Details for the file pigeonly_address-0.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for pigeonly_address-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 37e67166361b521b7ebfcddd219e5216756ff0add67c35c2bab108677e8dd3b9
MD5 cf8f1a57c53eb75ba51386176a4ab98f
BLAKE2b-256 9c0bec18689918a3d4358f82452cf065788a16750306709311685174126bb058

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page