{ "info": { "author": "Feite Brekeveld", "author_email": "f.brekeveld@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", "Topic :: Utilities" ], "description": "Django Postcode Proxy\n=========================\n\n[![Documentation Status](https://readthedocs.org/projects/django-postcodepy-proxy/badge/?version=latest)](http://django-postcodepy-proxy.readthedocs.org/en/latest/?badge=latest)\n[![PyPI version](https://badge.fury.io/py/django-postcodepy-proxy.svg)](http://badge.fury.io/py/django-postcodepy-proxy)\n[![PyPI](https://img.shields.io/pypi/dm/django-postcodepy-proxy.svg)]()\n[![Code Health](https://landscape.io/github/hootnot/django-postcodepy-proxy/master/landscape.svg?style=flat)](https://landscape.io/github/hootnot/django-postcodepy-proxy/master)\n\nSimple proxy class to integrate Dutch 'postcode/huisnr' address verification in your Django application.\nThis is done using the postcode.nl REST-API at [https://api.postcode.nl](https://api.postcode.nl). For documentation\nregarding API endpoints also check this url.\n\nThe API also provides an endpoint for information validation, enrichment and fraude risk check. See docs for details.\n\n---\n\nInstall\n=========\n\n $ pip install django-postcodepy-proxy\n\n\n\nQuick start\n-----------------\n\n1. Add 'postcodepy_proxy' to your INSTALLED_APPS setting like this::\n\n INSTALLED_APPS= (\n ...\n 'postcodepy_proxy',\n )\n\n2. Add the config part for the proxy::\n\n POSTCODEPY = {\n \"AUTH\" : {\n \"API_ACCESS_KEY\" : \"\",\n \"API_ACCESS_SECRET\" : \"\",\n },\n }\n\nIn your app ...\n================\n\nDerive a class from the *PostcodepyProxyView* class and implement your own logic like the 2 simple examples below for HTML and JSON rendering.\n\n## Simple HTML rendering\n \n from django.shortcuts import render\n\n # Create your views here.\n\n from postcodepy_proxy.views import PostcodepyProxyView\n from postcodepy import postcodepy\n\n class PCDemoHTMLView( PostcodepyProxyView ):\n template_name = \"postcodeproxy.html\"\n \n def get(self, request, *args, **kwargs):\n rv = super(PCDemoHTMLView, self).get(request, *args, **kwargs)\n return render(request, self.template_name, rv)\n\n\n## JSON rendering\n\nMost likely is that you want JSON rendering for XHR-io in your application. Implement exception-handling that suits your needs.\n\n\n from django.http import HttpResponse\n from postcodepy.postcodepy import PostcodeError\n import json\n\n class PCDemoJSONView( PostcodepyProxyView ):\n def get(self, request, *args, **kwargs):\n rv = None\n try:\n rv = super(PCDemoJSONView, self).get(request, *args, **kwargs)\n except PostcodeError, e:\n # Pass the exceptioninformation as response data\n rv = e.response_data\n\n return HttpResponse( json.dumps(rv), content_type=\"application/json\")\n\n\n## Signal Check \n\nUse the SignalProxyView to integrate the Signal API in your application.\n\n from postcodepy_proxy.views import SignalProxyView\n from postcodepy_proxy.signalapi import SignalRequestData\n from django.http import HttpResponse\n from postcodepy.postcodepy import PostcodeError\n import json\n\n class PCSignalJSONView( SignalProxyView ):\n \n def post(self, request, *args, **kwargs):\n \"\"\"\n perform the Signal lookup via the API-call\n \"\"\"\n rv = None\n try:\n # Create a structure representing a valid signal-api-request, as specified at api.postcode.nl\n sar = SignalRequestData(request.POST)\n sar = sar()\n if sar.has_key('csrfmiddlewaretoken'):\n del sar['csrfmiddlewaretoken']\n rv = super(PCSignalJSONView, self).get(request, sar=sar, **kwargs)\n except PostcodeError, e:\n # Pass the exceptioninformation as response data\n rv = e.response_data\n \n return HttpResponse( json.dumps(rv, indent=4), content_type=\"application/json\")\n\n\n## Route the requests\n\n # Postcode urls\n url(r'^jsonpostcode/(?P[\\d]{4}[a-zA-Z]{2})/(?P[\\d]+)/$', views.PCDemoJSONView.as_view() ),\n url(r'^jsonpostcode/(?P[\\d]{4}[a-zA-Z]{2})/(?P[\\d]+)/(?P[A-Za-z]+)/$', views.PCDemoJSONView.as_view() ),\n # Signal urls\n # signal.html with some form that enables you to post the information for the request via AJAX/JSON to\n # the jsonsignal url and fetch the response\n url(r'^signal/$', TemplateView.as_view(template_name=\"signal.html\")),\n url(r'^jsonsignal/$', views.PCSignalJSONView.as_view() ),", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/hootnot/django-postcodepy-proxy", "keywords": "postcode.nl REST API django proxy python", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "django-postcodepy-proxy", "package_url": "https://pypi.org/project/django-postcodepy-proxy/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/django-postcodepy-proxy/", "project_urls": { "Homepage": "https://github.com/hootnot/django-postcodepy-proxy" }, "release_url": "https://pypi.org/project/django-postcodepy-proxy/1.0.0/", "requires_dist": null, "requires_python": "", "summary": "simple Django app to make your backend serve as a proxy for the postcode.nl REST-API", "version": "1.0.0" }, "last_serial": 1978564, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "d384e3c4623563bae902dca730e7b3af", "sha256": "eebabe23cebce3c96b4d7ce34af98ede9ec813e7d375f29096366c032b32c8ab" }, "downloads": -1, "filename": "django-postcodepy-proxy-0.0.1.tar.gz", "has_sig": false, "md5_digest": "d384e3c4623563bae902dca730e7b3af", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4287, "upload_time": "2014-12-05T14:38:31", "url": "https://files.pythonhosted.org/packages/11/e4/17cdb834da9dc38d342b4877d8c3bb68b8faebe2c0589e15fbeab39cf7d2/django-postcodepy-proxy-0.0.1.tar.gz" } ], "0.0.2": [ { "comment_text": "", "digests": { "md5": "c4fa095bc98a2c5b89cb2522c22296c7", "sha256": "94aa1965a2db6ea82e4e537b816f046815182d80f30d73b77e184abe4b8f4e91" }, "downloads": -1, "filename": "django-postcodepy-proxy-0.0.2.tar.gz", "has_sig": false, "md5_digest": "c4fa095bc98a2c5b89cb2522c22296c7", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5547, "upload_time": "2014-12-19T08:18:20", "url": "https://files.pythonhosted.org/packages/b7/09/55028bd9db424e861d1128ca197d26ef53c2ed40cce2fb2975b90c343c86/django-postcodepy-proxy-0.0.2.tar.gz" } ], "1.0.0": [ { "comment_text": "", "digests": { "md5": "eb4cf4fb1480af210e3f984e095e9d53", "sha256": "75024c67bd3e941c9ec8b51e19ee751421d10448aaea1aacfa809a272ea15ae9" }, "downloads": -1, "filename": "django-postcodepy-proxy-1.0.0.tar.gz", "has_sig": false, "md5_digest": "eb4cf4fb1480af210e3f984e095e9d53", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9048, "upload_time": "2016-02-26T18:40:55", "url": "https://files.pythonhosted.org/packages/05/e4/564949b8453bb4db232bd4e591533bca4ce9343101c21b0c7bfb2d82b9ca/django-postcodepy-proxy-1.0.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "eb4cf4fb1480af210e3f984e095e9d53", "sha256": "75024c67bd3e941c9ec8b51e19ee751421d10448aaea1aacfa809a272ea15ae9" }, "downloads": -1, "filename": "django-postcodepy-proxy-1.0.0.tar.gz", "has_sig": false, "md5_digest": "eb4cf4fb1480af210e3f984e095e9d53", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9048, "upload_time": "2016-02-26T18:40:55", "url": "https://files.pythonhosted.org/packages/05/e4/564949b8453bb4db232bd4e591533bca4ce9343101c21b0c7bfb2d82b9ca/django-postcodepy-proxy-1.0.0.tar.gz" } ] }