Metadata-Version: 2.5
Name: django-postcode-lookup
Version: 2.0.0
Summary: Pluggable postcode lookup endpoint
Project-URL: Homepage, https://github.com/labd/django-postcode-lookup
Project-URL: Changelog, https://github.com/labd/django-postcode-lookup/blob/master/CHANGELOG.md
Author-email: Michael van Tellingen <michaelvantellingen@gmail.com>
License: The MIT License (MIT)
        
        Copyright (c) 2016 Lab Digital
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
License-File: LICENSE
Keywords: api,postcode,validation
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Web Environment
Classifier: Framework :: Django
Classifier: Framework :: Django :: 4.2
Classifier: Framework :: Django :: 5.2
Classifier: Framework :: Django :: 6.0
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Requires-Python: >=3.10
Requires-Dist: attrs>=26.1.0
Requires-Dist: django>=4.2
Requires-Dist: djangorestframework>=3.17.1
Requires-Dist: requests>=2.34.0
Description-Content-Type: text/markdown

# django-postcode-lookup

This Django app provides a pluggable postcode Django REST Framework endpoint. It
currently only works for postcodes in The Netherlands.

Currently supports the following services:

    - ApiWise
    - Webservices.nl
    - postcodeapi.nu

## Status

[![PyPI](https://img.shields.io/pypi/v/django-postcode-lookup.svg)](https://pypi.python.org/pypi/django-postcode-lookup/)

## Installation

```shell
pip install django_postcode_lookup
```

Minimum supported Django version: 5.2 (Django 6 supported)

## Usage

Add the following to your `urls.py`:

```python
path('postcode-lookup/', include('django_postcode_lookup.urls')),
```

Add a setting with the required backend

Webservices:

```python
POSTCODE_LOOKUP = {
    'default': {
        'backend': 'django_postcode_lookup.backends.Webservices',
        'OPTIONS': {
            'username': 'someuser',
            'password': 'somepassword',
        }
    }
}
```

ApiWise:

```python
POSTCODE_LOOKUP = {
    'default': {
        'backend': 'django_postcode_lookup.backends.ApiWise',
        'OPTIONS': {
            'api_key': 'somekey',
        }
    }
}
```

postcodeapi.nu:

```python
POSTCODE_LOOKUP = {
    'default': {
        'backend': 'django_postcode_lookup.backends.PostcodeApiNu',
        'OPTIONS': {
            'api_key': 'somekey',
            'base_url': 'https://somebaseurl.com',
        }
    }
}
```

To offer some form of protection to the api endpoint for usage by others a
valid csrf token is required.

## Changelog and releases

This project uses [changie](https://changie.dev/) for changelog management.

Add a changelog fragment in pull requests with:

```shell
changie new
```

To prepare a release, run the `Prepare release PR` GitHub Actions workflow. It batches unreleased fragments, updates `CHANGELOG.md` and version files, then opens a release pull request. Merging that release PR publishes the package and creates the GitHub release from the changelog entry.
