# Buildsheet autogenerated by ravenadm tool -- Do not edit. NAMEBASE= python-google-i18n-address VERSION= 3.1.1 KEYWORDS= python VARIANTS= v12 v13 SDESC[v12]= Address validation for Google's i18n DB (3.12) SDESC[v13]= Address validation for Google's i18n DB (3.13) HOMEPAGE= https://github.com/mirumee/google-i18n-address CONTACT= Python_Automaton[python@ironwolf.systems] DOWNLOAD_GROUPS= main SITES[main]= PYPIWHL/37/75/c4dadb4845c8c930b94c8ff9d2dfa9855c0a005366af539fee8095e30765 DISTFILE[1]= google_i18n_address-3.1.1-py2.py3-none-any.whl:main DIST_SUBDIR= python-src DF_INDEX= 1 SPKGS[v12]= single SPKGS[v13]= single OPTIONS_AVAILABLE= PY312 PY313 OPTIONS_STANDARD= none VOPTS[v12]= PY312=ON PY313=OFF VOPTS[v13]= PY312=OFF PY313=ON DISTNAME= google_i18n_address-3.1.1.dist-info GENERATED= yes [PY312].RUN_DEPENDS_ON= python-requests:single:v12 [PY312].USES_ON= python:v12,wheel [PY313].RUN_DEPENDS_ON= python-requests:single:v13 [PY313].USES_ON= python:v13,wheel [FILE:2745:descriptions/desc.single] # Google i18n address ![codecov.io] ![GH Actions] ![PyPi downloads] ![PyPi version] ![PyPi pythons] This package contains a copy of [Google's i18n address] metadata repository that contains great data but comes with no uptime guarantees. Contents of this package will allow you to programmatically build address forms that adhere to rules of a particular region or country, validate local addresses, and format them to produce a valid address label for delivery. The package also contains a Python interface for address validation. ## Addresses validation The `normalize_address` function checks the address and either returns its canonical form (suitable for storage and use in addressing envelopes) or raises an `InvalidAddressError` exception that contains a list of errors. ### Address fields Here is the list of recognized fields: - `country_code` is a two-letter ISO 3166-1 country code - `country_area` is a designation of a region, province, or state. Recognized values include official names, designated abbreviations, official translations, and Latin transliterations - `city` is a city or town name. Recognized values include official names, official translations, and Latin transliterations - `city_area` is a sublocality like a district. Recognized values include official names, official translations, and Latin transliterations - `street_address` is the (possibly multiline) street address - `postal_code` is a postal code or zip code - `sorting_code` is a sorting code - `name` is a person's name - `company_name` is a name of a company or organization ### Errors Address validation with only country code: ```python from i18naddress import InvalidAddressError, normalize_address try: address = normalize_address({'country_code': 'US'}) except InvalidAddressError as e: print(e.errors) ``` Output: ```python {'city': 'required', 'country_area': 'required', 'postal_code': 'required', 'street_address': 'required'} ``` With correct address: ```python from i18naddress import normalize_address address = normalize_address({ 'country_code': 'US', 'country_area': 'California', 'city': 'Mountain View', 'postal_code': '94043', 'street_address': '1600 Amphitheatre Pkwy' }) print(address) ``` Output: ```python {'city': 'MOUNTAIN VIEW', 'city_area': '', 'country_area': 'CA', 'country_code': 'US', 'postal_code': '94043', 'sorting_code': '', 'street_address': '1600 Amphitheatre Pkwy'} ``` Postal code/zip code validation example: ```python from i18naddress import InvalidAddressError, normalize_address try: address = normalize_address({ 'country_code': 'US', 'country_area': 'California', 'city': 'Mountain View', 'postal_code': '74043', [FILE:136:distinfo] f66f4fd2b75d1cd371fc0a7678a1d656da4aa3b32932279e78dd6cae776fc23d 772645 python-src/google_i18n_address-3.1.1-py2.py3-none-any.whl