Skip to main content

Formatting utility for international postal addresses

Project description

International Address formatter

This is a address formatter that can format addresses in multiple formats that are common in different countries.

For formatting the addresses the worldwide.yml from OpenCageData address-formatting repository is used to format the address according to customs in the country that is been encoded.

API documentation

The complete project contains actually only one class:

AddressFormatter

Publicly accessible method prototypes are:

def __init__(self, config=None):
    pass

def format(self, address, country=None):
    pass

def one_line(self, address, country=None):
    pass

__init__

Initialize the address formatter

  • config: (optional) override default config file to use for the address formatter, defaults to config file included in this package

format

Format an address in the default layout used in the specified country. Return value may contain line breaks.

  • address: Dictionary that contains the address parts, see below for recognized keys
  • country: Country code of the formatting template to use

Recognized keys in address:

  • attention
  • house
  • road
  • house_number
  • postcode
  • city
  • town
  • village
  • county
  • state
  • country
  • suburb
  • city_district
  • state_district
  • state_code
  • neighbourhood

one_line

Works the same as format but returns a single line of text.

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

addressformatting-1.1.1.tar.gz (11.7 kB view details)

Uploaded Source

Built Distribution

addressformatting-1.1.1-py2.py3-none-any.whl (11.8 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file addressformatting-1.1.1.tar.gz.

File metadata

  • Download URL: addressformatting-1.1.1.tar.gz
  • Upload date:
  • Size: 11.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.9.5

File hashes

Hashes for addressformatting-1.1.1.tar.gz
Algorithm Hash digest
SHA256 c4df00b199d641f019d9c1d0eb88520f935107d187e495e94145076bf8aa4464
MD5 9097eee6775cb4963a43f0a1d7c15f62
BLAKE2b-256 44c2fc128365dce2a63f270c31e22b1f0fd9698a4415da361033a1a44c3c932a

See more details on using hashes here.

File details

Details for the file addressformatting-1.1.1-py2.py3-none-any.whl.

File metadata

  • Download URL: addressformatting-1.1.1-py2.py3-none-any.whl
  • Upload date:
  • Size: 11.8 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.9.5

File hashes

Hashes for addressformatting-1.1.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 54b2c7f72cc8d5835a31254e5eea7930a478720deb8f2a880befce3611b5975f
MD5 3c73207b5854930dbf5b8cd3e69ac9f5
BLAKE2b-256 63f1ecbeee0f3a963655b2fa29454a16c152c1cb7427aa26c4dd084b00a575e8

See more details on using hashes here.

Supported by

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