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 keyscountry
: 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
Built Distributions
File details
Details for the file addressformatting-1.0.2.tar.gz
.
File metadata
- Download URL: addressformatting-1.0.2.tar.gz
- Upload date:
- Size: 12.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 70d8a82e40f6b7344d15146c0b583e2990b2a3a14cba660678a9c9a323d13d24 |
|
MD5 | 4685f8c543f245c61d499eb25751d1d3 |
|
BLAKE2b-256 | 6a72347e19d1d024205e86c0e853353caab6cb715e4b3ba59456bb8f87faa643 |
File details
Details for the file addressformatting-1.0.2-py3-none-any.whl
.
File metadata
- Download URL: addressformatting-1.0.2-py3-none-any.whl
- Upload date:
- Size: 11.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ff72d88f636474313f2b7c14c83af111eac1f61be1834e2656dfe724ef5a3dec |
|
MD5 | ce28ee54f9989917c48e1ff9caeb1bee |
|
BLAKE2b-256 | 28101232268656da9d81a0236b26260fd14a891eb38c73c8a2981c95b0b280cb |
File details
Details for the file addressformatting-1.0.2-py2.py3-none-any.whl
.
File metadata
- Download URL: addressformatting-1.0.2-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.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 637bd938429b95c97ee7ad16bc3052c0c9f2d031f827c91de89571a7247f48cb |
|
MD5 | ac55262b6388c57be31fb7bf1eeb9861 |
|
BLAKE2b-256 | 4973eb7ce6dc3cc2cde55f6b97460924bf61442756466e16a5406b55b20e1d53 |