{"id":21915050,"url":"https://github.com/hootnot/django-postcodepy-proxy","last_synced_at":"2025-03-22T09:23:01.786Z","repository":{"id":24200980,"uuid":"27592361","full_name":"hootnot/django-postcodepy-proxy","owner":"hootnot","description":"Django proxy app to get information from postcode.nl API ","archived":false,"fork":false,"pushed_at":"2016-09-13T05:38:42.000Z","size":39,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-27T14:43:43.555Z","etag":null,"topics":["django","postcode","python"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hootnot.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-12-05T13:19:54.000Z","updated_at":"2016-02-26T17:54:47.000Z","dependencies_parsed_at":"2022-08-22T14:30:23.331Z","dependency_job_id":null,"html_url":"https://github.com/hootnot/django-postcodepy-proxy","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hootnot%2Fdjango-postcodepy-proxy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hootnot%2Fdjango-postcodepy-proxy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hootnot%2Fdjango-postcodepy-proxy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hootnot%2Fdjango-postcodepy-proxy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hootnot","download_url":"https://codeload.github.com/hootnot/django-postcodepy-proxy/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244933199,"owners_count":20534306,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["django","postcode","python"],"created_at":"2024-11-28T19:08:36.197Z","updated_at":"2025-03-22T09:23:01.765Z","avatar_url":"https://github.com/hootnot.png","language":"Python","readme":"Django Postcode Proxy\n=========================\n\n[![Build Status](https://travis-ci.org/hootnot/django-postcodepy-proxy.svg?branch=master)](https://travis-ci.org/hootnot/django-postcodepy-proxy)\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[![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[![Coverage Status](https://coveralls.io/repos/github/hootnot/django-postcodepy-proxy/badge.svg?branch=master)](https://coveralls.io/github/hootnot/django-postcodepy-proxy?branch=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.\n\nBeside this documentation, the complete documentation of this software is available at\n[http://django-postcodepy-proxy.readthedocs.org](http://django-postcodepy-proxy.readthedocs.org/en/latest/?badge=latest).\n\n\nSupported versions of Python and Django :\n\n|                | **Py 2.7** | **Py 3.4** | **Py 3.5** |\n| :------------: | :--------: | :--------: | :--------: | \n| **Django 1.8** | YES        | YES        | YES        |\n| **Django 1.9** | YES        | YES        | YES        |\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\" : \"\u003cthe key you got from postcode.nl\u003e\",\n             \"API_ACCESS_SECRET\" : \"\u003cthe secret you got from postcode.nl\u003e\",\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,\n                  # as specified at api.postcode.nl\n                  sar = SignalRequestData(request.POST)()\n                  if 'csrfmiddlewaretoken' in sar:\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\u003cpostcode\u003e[\\d]{4}[a-zA-Z]{2})/(?P\u003chouseNumber\u003e[\\d]+)/$', views.PCDemoJSONView.as_view()),\n      url(r'^jsonpostcode/(?P\u003cpostcode\u003e[\\d]{4}[a-zA-Z]{2})/(?P\u003chouseNumber\u003e[\\d]+)/(?P\u003chouseNumberAddition\u003e[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()),\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhootnot%2Fdjango-postcodepy-proxy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhootnot%2Fdjango-postcodepy-proxy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhootnot%2Fdjango-postcodepy-proxy/lists"}