Skip to main content

A tiny wrapper around the Postcode API v2

Project description

# postcodeapi

`postcodeapi` is a tiny Python wrapper around the Postcode API V2.

[![PyPI version](https://badge.fury.io/py/postcodeapi.svg)](https://badge.fury.io/py/postcodeapi)
[![Build Status](https://travis-ci.org/roedesh/postcodeapi.svg?branch=master)](https://travis-ci.org/roedesh/postcodeapi)
[![Requirements Status](https://requires.io/github/roedesh/postcodeapi/requirements.svg?branch=master)](https://requires.io/github/roedesh/postcodeapi/requirements/?branch=master)
[![Coverage Status](https://coveralls.io/repos/github/roedesh/postcodeapi/badge.svg?branch=master)](https://coveralls.io/github/roedesh/postcodeapi?branch=master)

## Installation and usage

### Installation

*postcodeapi* can be installed by running `pip install postcodeapi`.

### Usage

Here is an example of how to use the API client. First you initialize a client with your API key, after that you use
one of the four getter methods to fetch the data you need. They all return the actual JSON response converted to a
Python dictionary.

```python
# Import the PostcodeAPIClient
from postcodeapi.client import PostcodeAPIClient

# Initialize a client with your API key
client = PostcodeAPIClient(api_key="YOUR_API_KEY")

# Fetch a list of addresses (for a given postal_code and number)
# The postal_code and number parameters are optional
# The number parameter only works together with postal_code
data = client.get_all_addresses(postal_code="5038EA", number=19)
addresses = data["_embedded"]["addresses"] # List of addresses

# Fetch a single address
address = client.get_address(address_id="0855200000046355")

# Fetch a list of postal codes (within a specific area)
# The area parameter is optional
data = client.get_all_postal_codes(area="5038")
postal_codes = data['_embedded']['postcodes'] # List of postal codes

# Fetch a single postal code
postal_code = client.get_postal_code("5038EA")
```

## Documentation
For more information about the data that is returned, please refer to the [official API documentation](https://www.postcodeapi.nu/docs/). It is written in Dutch.

## Running tests
To run the tests, make sure you have the dev dependencies installed, and run `pytest` in the root of the project.

## Issues
If you have any issues with the API wrapper, please post them [here](https://github.com/infoklik/postcodeapi/issues). If you have issues with the actual API,
please post them in the [official issue tracker](https://github.com/postcodeapi/postcodeapi/issues) of Postcode API.

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

postcodeapi-1.0.2.tar.gz (3.6 kB view details)

Uploaded Source

Built Distribution

postcodeapi-1.0.2-py3-none-any.whl (4.5 kB view details)

Uploaded Python 3

File details

Details for the file postcodeapi-1.0.2.tar.gz.

File metadata

  • Download URL: postcodeapi-1.0.2.tar.gz
  • Upload date:
  • Size: 3.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: Python-urllib/3.7

File hashes

Hashes for postcodeapi-1.0.2.tar.gz
Algorithm Hash digest
SHA256 c76cdaeb2cf2a9d2b0377d5889aef40c33801763d5c4e133e181ef6054aa2bb2
MD5 5cc5e99d4cbd2df18d431d783c734b03
BLAKE2b-256 0389047bb80e692f76b6230d6baead56fdd57c6597d3357dc7c33f829d54b5f6

See more details on using hashes here.

File details

Details for the file postcodeapi-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: postcodeapi-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 4.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: Python-urllib/3.7

File hashes

Hashes for postcodeapi-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 6f7afeb346887fb5236f5da0cc5e8c8b54ee9d369594290e193c9ae8ddcfeb22
MD5 d6771866140217dc273de00cd2e7bc6d
BLAKE2b-256 59cfd83601b8d8f4a45f83d6eea4eb153b7c4a58de1cecb9abd1bb1e6d316f3d

See more details on using hashes here.

Supported by

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