Requirements :
- Python 3.6
pip install postcodes-uk
In the root folder execute :
python setup.py install
import postcodes_uk
postcodes_uk.validate("EC1A 1BB")
This will return a boolean with the validation result.
from postcodes_uk import Postcode
postcode = Postcode(area="EC", district="1A", sector=1, unit="BB")
print(postcode)
This will print the formatted postcode.
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.
In the root folder, execute :
pytest