Skip to main content

A simple UK postcode validator.

Project description

postcode-validator-uk

Python CircleCI codecov

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.

Files for postcode-validator-uk, version 0.0.5
Filename, size File type Python version Upload date Hashes
Filename, size postcode_validator_uk-0.0.5-py3-none-any.whl (9.2 kB) File type Wheel Python version py3 Upload date Hashes View hashes
Filename, size postcode-validator-uk-0.0.5.tar.gz (6.9 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page