Metadata-Version: 2.1
Name: addressformatting
Version: 1.3.2
Summary: Formatting utility for international postal addresses
Home-page: https://github.com/pudo/addressformatting
Author: Friedrich Lindenberg
Author-email: friedrich@pudo.org
License: BSD
Keywords: address formatting,international
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: BSD License
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Operating System :: OS Independent
Description-Content-Type: text/markdown
License-File: LICENSE.txt
Requires-Dist: PyYAML (>=5.0)
Requires-Dist: chevron (>=0.14.0)
Provides-Extra: dev
Requires-Dist: pytest ; extra == 'dev'
Requires-Dist: bump2version ; extra == 'dev'
Requires-Dist: wheel (>=0.29.0) ; extra == 'dev'
Requires-Dist: twine ; extra == 'dev'

# 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](https://github.com/OpenCageData/address-formatting) 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:

```python
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.
