Metadata-Version: 2.1
Name: django-postcode-lookup
Version: 1.0.1
Summary: Pluggable postcode lookup endpoint
Home-page: https://github.com/labd/django-postcode-lookup
Author: Michael van Tellingen
Author-email: michaelvantellingen@gmail.com
License: MIT
Keywords: postcode,api,validation
Platform: UNKNOWN
Classifier: Development Status :: 5 - Production/Stable
Classifier: Environment :: Web Environment
Classifier: Framework :: Django
Classifier: Framework :: Django :: 3.2
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Requires-Dist: Django (<4,>=3.2)
Requires-Dist: attrs
Requires-Dist: djangorestframework (<4,>=3)
Requires-Dist: requests (>=2.7)
Provides-Extra: docs
Requires-Dist: sphinx (>=1.5.2) ; extra == 'docs'
Provides-Extra: test
Requires-Dist: freezegun (==1.1.0) ; extra == 'test'
Requires-Dist: pretend (==1.0.9) ; extra == 'test'
Requires-Dist: pytest-cov (==2.11.1) ; extra == 'test'
Requires-Dist: pytest-django (==4.1.0) ; extra == 'test'
Requires-Dist: pytest (==6.1.2) ; extra == 'test'
Requires-Dist: requests-mock (==1.8.0) ; extra == 'test'
Requires-Dist: coverage (==5.3) ; extra == 'test'
Requires-Dist: isort (<5) ; extra == 'test'
Requires-Dist: flake8 (==3.8.4) ; extra == 'test'
Requires-Dist: flake8-blind-except (==0.1.1) ; extra == 'test'
Requires-Dist: flake8-debugger (==3.2.1) ; extra == 'test'

======================
django-postcode-lookup
======================

This Django app providers 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
======
.. image:: https://travis-ci.org/LabD/django-postcode-lookup.svg?branch=master
    :target: https://travis-ci.org/LabD/django-postcode-lookup

.. image:: http://codecov.io/github/LabD/django-postcode-lookup/coverage.svg?branch=master 
    :target: http://codecov.io/github/LabD/django-postcode-lookup?branch=master

.. image:: https://img.shields.io/pypi/v/django-postcode-lookup.svg
    :target: https://pypi.python.org/pypi/django-postcode-lookup/

Installation
============

.. code-block:: shell

   pip install django_postcode_lookup

Usage
=====

Add the following to your urls.py:


.. code-block:: python

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


Add a setting with the required backend

Webservices:

.. code-block:: python

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

ApiWise:

.. code-block:: python

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

postcodeapi.nu:

.. code-block:: 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.


