Giter Club home page Giter Club logo

pypostcode's People

Contributors

astirpe avatar gdalmau avatar hbrunn avatar janverb avatar mdxs avatar steffex avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

pypostcode's Issues

Limitations using "huisletter" and "toevoeging"

Perhaps an implementation issue in postcodeapi.nu itself, but I've not yet found how the API is to differentiate between "1185ZH/7/G" and "1185ZH/7/G/BIS" (see https://www.postcode.nl/1185ZH/7/G with 43m2 and https://www.postcode.nl/1185ZH/7/G%20BIS with 32m2)

Instead, the API seems to return (with "view=bag" added) in both cases the id="0362010002002946" VBO; which can be queried for via https://service1.kadaster.nl/bag/bag-burger/secured/selectie, using "Verblijfsobject" (VBO) and the id above... showing that it belongs to "1185ZH/7/A"

Looking at the (current) "bag-adressen-bagaveen.csv.gz" file downloaded from http://data.nlextract.nl/bag/csv/; it shows that "VBO 0362010002002951"="1185ZH/7/G" and "VBO 0362010002182896"="1185ZH/7/G/BIS"; which can be confirmed by above Kadaster search feature... and note how the m2 values match the postcode.nl checks.

To me it seems like postcodeapi.nu is (incorrectly) ignoring "huisletter" and "huisnummertoevoeging" when parsing the BAG extract (and I assume that they use similar files like the ones that can be obtained from http://data.nlextract.nl/bag/csv/ (maybe more directly from the source agencies). It appears that their implementation always returns the first "7" found (or perhaps imported?) and ignoring any further detailing.

Now, as said, this might be due to me not correctly reading the API documentation for this service at http://api.postcodeapi.nu/docs/resources/housenumber

Python 2.7.6: _ssl.c:510: error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure>

FYI / FWIW:

On Ubuntu 14.04.5 LTS (with Python 2.7.6) the example.py does not work. See below.

The error

urllib2.URLError: <urlopen error [Errno 1] _ssl.c:510: error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure>

is a common problem with older python versions in combination with TLS and possibly SNI (Server Name Indication). So far I have not found a solution or workaround within python 2.7.6.
With python 2.7.11 it works fine.

It's easy to reproduce with three lines of code:

$ python
Python 2.7.6 (default, Oct 26 2016, 20:32:47)
[GCC 4.8.4] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import urllib2
>>> req = urllib2.Request("https://postcode-api.apiwise.nl/")
>>> resp = urllib2.urlopen(req)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.7/urllib2.py", line 127, in urlopen
    return _opener.open(url, data, timeout)
  File "/usr/lib/python2.7/urllib2.py", line 404, in open
    response = self._open(req, data)
  File "/usr/lib/python2.7/urllib2.py", line 422, in _open
    '_open', req)
  File "/usr/lib/python2.7/urllib2.py", line 382, in _call_chain
    result = func(*args)
  File "/usr/lib/python2.7/urllib2.py", line 1222, in https_open
    return self.do_open(httplib.HTTPSConnection, req)
  File "/usr/lib/python2.7/urllib2.py", line 1184, in do_open
    raise URLError(err)
urllib2.URLError: <urlopen error [Errno 1] _ssl.c:510: error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure>

Output of example.py with Python 2.7.6:

sander@haring:~/postcode-API/git_postcodeapi$ python example.py
ERROR:root:<urlopen error [Errno 1] _ssl.c:510: error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure>
Traceback (most recent call last):
  File "/home/sander/postcode-API/git_postcodeapi/pyPostcode/__init__.py", line 99, in getaddress
    data = self.request(path)
  File "/home/sander/postcode-API/git_postcodeapi/pyPostcode/__init__.py", line 65, in request
    self.url + path, headers=headers,
  File "/usr/lib/python2.7/urllib2.py", line 127, in urlopen
    return _opener.open(url, data, timeout)
  File "/usr/lib/python2.7/urllib2.py", line 404, in open
    response = self._open(req, data)
  File "/usr/lib/python2.7/urllib2.py", line 422, in _open
    '_open', req)
  File "/usr/lib/python2.7/urllib2.py", line 382, in _call_chain
    result = func(*args)
  File "/usr/lib/python2.7/urllib2.py", line 1222, in https_open
    return self.do_open(httplib.HTTPSConnection, req)
  File "/usr/lib/python2.7/urllib2.py", line 1184, in do_open
    raise URLError(err)
URLError: <urlopen error [Errno 1] _ssl.c:510: error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure>
ERROR:root:<urlopen error [Errno 1] _ssl.c:510: error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure>
Traceback (most recent call last):
  File "/home/sander/postcode-API/git_postcodeapi/pyPostcode/__init__.py", line 99, in getaddress
    data = self.request(path)
  File "/home/sander/postcode-API/git_postcodeapi/pyPostcode/__init__.py", line 65, in request
    self.url + path, headers=headers,
  File "/usr/lib/python2.7/urllib2.py", line 127, in urlopen
    return _opener.open(url, data, timeout)
  File "/usr/lib/python2.7/urllib2.py", line 404, in open
    response = self._open(req, data)
  File "/usr/lib/python2.7/urllib2.py", line 422, in _open
    '_open', req)
  File "/usr/lib/python2.7/urllib2.py", line 382, in _call_chain
    result = func(*args)
  File "/usr/lib/python2.7/urllib2.py", line 1222, in https_open
    return self.do_open(httplib.HTTPSConnection, req)
  File "/usr/lib/python2.7/urllib2.py", line 1184, in do_open
    raise URLError(err)
URLError: <urlopen error [Errno 1] _ssl.c:510: error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure>
Traceback (most recent call last):
  File "example.py", line 7, in <module>
    print result.street
AttributeError: 'bool' object has no attribute 'street'

With python 2.7.11 it works fine:

sander@haring:~/postcode-API/git_postcodeapi$ /opt/python2711/bin/python example.py
De Ruijterkade
125
1011AC
Amsterdam
Amsterdam
Noord-Holland
52.3776421
4.9066958
122281
487861
De Ruijterkade
154
1011AC
Amsterdam
Amsterdam
Noord-Holland
52.3772667
4.9094314
122467
487818

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.