mvexel / overpass-api-python-wrapper

Python bindings for the OpenStreetMap Overpass API
Apache License 2.0
368 stars 90 forks source link

In import please substitute httplib module with http.client module #77

Closed marcobra closed 7 years ago

marcobra commented 7 years ago

Hi trying to run the code with debug, if i set debug on

in api = overpass.API(timeout=600, debug=True)

i get httplib module import error

to made it works in the file /usr/local/lib/python3.5/dist-packages/overpass/api.py

i must set this code import http.client

and then i must change: httplib.HTTPConnection.debuglevel = 1

with http.client.HTTPConnection.debuglevel = 1

as below: ... if self.debug: import http.client import logging http.client.HTTPConnection.debuglevel = 1 ...

mvexel commented 7 years ago

Could you elaborate? Which Python version? Why are you missing httplib?

If it makes sense I'd take a PR :)

marcobra commented 7 years ago

Python 3.5.3

i have in my system

python3-httplib2 is already the newest version (0.9.2+dfsg-1) so i can import import httplib2

but module httplib was renamed from python2

i've update original message ... i hope is more clear now ...

Please read the section: A.9. Modules that have been renamed or reorganized in this page http://www.diveintopython3.net/porting-code-to-python-3-with-2to3.html Thank

mvexel commented 7 years ago

This has been fixed. Tested and works in Python 3.5