Open larsklitzke opened 5 years ago
Well, it seems that the context parameter for urlopen exists in 2.7.9 <= Python < 3 and was reintroduced in 3.4.3. Thus, the test builds for Python 3.0 - 3.3 are broken. This issue was also discussed on stackoverflow but the only answer was to upgrade Python.
So, either merge this patch to the master branch and applications using Overpy with a Python3 version of < 3.4.3 will break, create a new branch which only support Python > 3.3 or simply neglect that pull request.
Issue type
Summary
I have a self hosted OpenStreetMap server which can only be accessed using SSL connections. The certificates are however generated using certbot and thus queries cannot be send using overpy due to the fact that those certificates are by default marked as unverified.
Hence, to fix this issue, I've added a new optional parameter context to the constructor of the Overpass object in order to define an optional ssl context which is passed to the call of urlopen in the query method.
So, if you want to connect to a Overpass server with a self signed certificate, create a new ssl context with:
ssl_context = ssl._create_unverified_context()
and setup a new Overpass object using that context
opy = overpy.Overpass(url='https://example.com/api/interpreter', context=ssl_context)