A simple UK postcode validator.
Project description
postcode-validator-uk
A simple UK postcode validator.
Implemented following these instructions: Wikipedia - Postcodes in the United Kingdom.
Install
postcode-validator-uk is available on PyPI:
$ pip install postcode-validator-uk
Usage
from postcode_validator_uk.validators import UKPostcode
postcode = UKPostcode('ec1a 1bb')
postcode.validate()
postcode.validated_postcode
# output
'EC1A 1BB'
postcode.raw_postcode
# output
'ec1a 1bb'
postcode.outward
# output
'EC1A'
postcode.inward
# output
'1BB'
postcode.area
# output
'EC'
postcode.district
# output
'1A'
postcode.sector
# output
'1'
postcode.unit
# output
'BB'
Running tests
$ pipenv install --dev
$ make test
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 Distribution
Close
Hashes for postcode-validator-uk-0.0.3.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4acab219592dc5d231ed84b1664cdda6a9fade404b8012c9c9723ed1d19b1057 |
|
MD5 | e05cad3608eab7919575c5ee0399cb4f |
|
BLAKE2b-256 | 6d9ff3b8e19c3f89061f4a6de36073f92ac959ade52a6a07728dabcb86dcbe81 |
Close
Hashes for postcode_validator_uk-0.0.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 71c30ef67d674ad53092238e9e2d7e7290503f29ca29eb56bd3f2582ef137c6c |
|
MD5 | 3bc8ade8eda7f97ba7d7718052e68e1d |
|
BLAKE2b-256 | 55457a96eb01acc284cca5032855a9aba5611e3caaeeda87ff8dd61027ef511a |