Validate and format UK postcodes.
Project description
UK postcodes library
Requirements :
- Python 3.6
How to install it ?
Using PIP
pip install postcodes-uk
Manually
In the root folder execute :
python setup.py install
How to use it ?
Validate a postcode
import postcodes_uk
postcodes_uk.validate("EC1A 1BB")
This will return a boolean with the validation result.
Format a postcode
from postcodes_uk import Postcode
postcode = Postcode(area="EC", district="1A", sector=1, unit="BB")
print(postcode)
This will print the formatted postcode.
Create a Postcode object from a string
from postcodes_uk import Postcode
postcode = Postcode.from_string("EC1A 1BB")
print(postcode.area)
This could be useful to extract the area/district/sector/unit from the postcode.
How to execute the tests ?
In the root folder, execute :
pytest
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file postcodes_uk-1.0.2-py3-none-any.whl.
File metadata
- Download URL: postcodes_uk-1.0.2-py3-none-any.whl
- Upload date:
- Size: 9.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/0.0.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0.post20200714 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.8.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8813e3a350d91719028c5cb2272f422063b0f8662213519080b13e60e276f38a
|
|
| MD5 |
23077f9241a76f21a8757005594e43f1
|
|
| BLAKE2b-256 |
30ae7f6969be6b5f9e8403d6bfc138d7573621ce9d0cc3ed1635bbe1fed8c1d2
|