postcodes_io_api
A library that provides a Python interface to the postcodes_io API.
Project URLs
- Project Home : https://postcodes.io
- Project Doc : https://postcodes.io/docs
Example
import postcodes_io_api
api = postcodes_io_api.Api(debug_http=True)
data = api.get_postcode('SW112EF')
Api
Api(self, debug_http=False, timeout=None, base_url=None)
is_postcode_valid
Api.is_postcode_valid(self, postcode)
This method validates post_code
- :param postcode - postcode to check i.e. 'SW112EF'
- :return - True if postcode is valid False if postcode is invalid
is_valid = api.is_postcode_valid('SW112EF')
is_postcode_terminated
Api.is_postcode_terminated(self, postcode)
- :param postcode - postcode to check i.e. 'SW112ZW'
- :return True if postcode is terminated or False otherwise
is_terminated = api.is_postcode_terminated('SW112EF')
get_postcode
Api.get_postcode(self, postcode)
This method returns data for post_code
- :param postcode - postcode to check i.e. 'SW112EF'
- ::return - postcode detailed data
data = api.get_postcode('SW112EF')
get_nearest_postcodes_for_postcode
Api.get_nearest_postcodes_for_postcode(self, **kwargs)
- kwargs
- :param postcode - postcode
- :param limit - (not required) Limits number of postcodes matches to return. Defaults to 10. Needs to be less than 100.
- :param radius - (not required) Limits number of postcodes matches to return. Defaults to 100m. Needs to be less than 2,000m.
- :return: - list of nearest postcodes data
data = api.get_nearest_postcodes_for_postcode(postcode='SW112EF',limit=2)
get_nearest_postcodes_for_coordinates
Api.get_nearest_postcodes_for_coordinates(self, **kwargs)
- kwargs
- :param latitude - (required) Latitude
- :param longitude - (required) Longitude
- :param limit - (not required) Limits number of postcodes matches to return. Defaults to 10. Needs to be less than 100.
- :param radius - (not required) Limits number of postcodes matches to return. Defaults to 100m. Needs to be less
- :return: - list of nearest postcodes data
data = api.get_nearest_postcodes_for_coordinates(latitude=51.466324,longitude=-0.173606,limit=2)
get_bulk_postcodes
Api.get_bulk_postcodes(self, postcodes_list)
- :param postcodes_list - list containing postcodes
- :return - list of postcode data
postcode_list = ["SW112EF","HA97QP"]
data = api.get_bulk_postcodes(postcode_list)
get_bulk_reverse_geocode
Api.get_bulk_reverse_geocode(self, payload_data)
- :param payload_data - dict with cordinates e.g.
payload_data = {
"geolocations":
[
{
"longitude": 0.629834723775309,
"latitude": 51.7923246977375
},
{
"longitude": -2.49690382054704,
"latitude": 53.5351312861402,
"radius": 1000,
"limit": 5
}
]
}
- :return - list of postcode data
data = api.get_bulk_reverse_geocode(payload_data)
get_random_postcode
Api.get_random_postcode(self)
- :return - random postcode
data = api.get_random_postcode()
get_autocomplete_postcode
Api.get_autocomplete_postcode(self, **kwargs)
- kwargs
- :param postcode - partial postcode
- :param limit - (not required) Limits number of postcodes matches to return. Defaults to 10. Needs to be less than 100.
- :return - list of possible postcodes
data = api.get_autocomplete_postcode(postcode='SW18',limit=2)
get_outcode
Api.get_outcode(self, outcode)
This method returns data for post_code
- :param outcode - postcode outward code to check i.e. 'KT1'
- :return - postcode detailed data
data = api.get_outcode('KT1')
get_nearest_outcodes_for_outcode
Api.get_nearest_outcodes_for_outcode(self, **kwargs)
- kwargs
- :param outcode - outward code
- :param limit - (not required) Limits number of postcodes matches to return. Defaults to 10. Needs to be less than 100.
- :param radius - (not required) Limits number of postcodes matches to return. Defaults to 100m. Needs to be less than 2,000m.
- :return: - list of nearest postcodes data
data = api.get_nearest_outcodes_for_outcode(outcode='KT1',limit=2)
get_nearest_outcodes_for_coordinates
Api.get_nearest_outcodes_for_coordinates(self, **kwargs)
- kwargs
- :param latitude - (required) Latitude
- :param longitude - (required) Longitude
- :param limit - (not required) Limits number of postcodes matches to return. Defaults to 10. Needs to be less than 100.
- :param radius - (not required) Limits number of postcodes matches to return. Defaults to 100m. Needs to be less
- :return: - list of nearest outcodes data
data = api.get_nearest_outcodes_for_coordinates(latitude=51.466324,longitude=-0.173606,limit=2)
Changelog - postcodes_io_api
A library that provides a Python interface to the postcodes_io API.
0.0.4 (12-01-2019)
- fixed packaging issues for python 2
0.0.3 (12-01-2019)
- added suport for python 2
0.0.2 (07-01-2019)
- fixed requirements and setup file
0.0.1 (07-01-2019)
- initial release
Metadata
Release files for postcodes-io-api 0.0.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| postcodes_io_api-0.0.4.tar.gz | 6.2 kB | Without provenance | Details for postcodes_io_api-0.0.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| postcodes_io_api-0.0.4-py3-none-any.whl | Python 3 | none | any | Details for postcodes_io_api-0.0.4-py3-none-any.whl |
Total release size: 13.8 kB
Release files / postcodes_io_api-0.0.4.tar.gz
| Download URL | postcodes_io_api-0.0.4.tar.gz |
|---|---|
| Size | 6.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c36b2ae7c1c2196e8c152aab0ee36c325590aaa7c0fd1cc46bdf107ef4ecb32f
|
|
BLAKE2b-256 checksum How to use checksums |
21f5dd5558043b1730dcf3591045a2ee09b45385081349ad8ff86e83f156150e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.12.1 pkginfo/1.4.2 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.29.0 CPython/3.6.5
|
Release files / postcodes_io_api-0.0.4-py3-none-any.whl
| Download URL | postcodes_io_api-0.0.4-py3-none-any.whl |
|---|---|
| Size | 7.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
cfe086f484ba0496485b061d4a6a422d6d6fd1c4433d642d4753ad36911bff87
|
|
BLAKE2b-256 checksum How to use checksums |
2677966f119d0b2628b5e92dc7924eb9662b97ce80ffe2b571eda0a687e5b7ed
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.12.1 pkginfo/1.4.2 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.29.0 CPython/3.6.5
|
Security for postcodes-io-api 0.0.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.