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.

Source Distribution

postcode-validator-uk-0.0.4.tar.gz (4.1 kB view hashes)

Uploaded Source

Built Distribution

postcode_validator_uk-0.0.4-py3-none-any.whl (5.7 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page