metaodi / osmapi

Python wrapper for the OpenStreetMap API
http://osmapi.metaodi.ch/
GNU General Public License v3.0
212 stars 41 forks source link

nodename nor servname provided, or not known #61

Closed hanchao closed 7 years ago

hanchao commented 8 years ago
api = osmapi.OsmApi(api="localhost:3000")
print api.Capabilities()

output

[Errno 8] nodename nor servname provided, or not known
[Errno 8] nodename nor servname provided, or not known
[Errno 8] nodename nor servname provided, or not known
[Errno 8] nodename nor servname provided, or not known
Traceback (most recent call last):
  File "/Users/hanchao/PycharmProjects/importTest/importTest.py", line 14, in <module>
    print api.Capabilities()
  File "/Library/Python/2.7/site-packages/osmapi/OsmApi.py", line 279, in Capabilities
    data = self._get(uri)
  File "/Library/Python/2.7/site-packages/osmapi/OsmApi.py", line 1979, in _get
    return self._http('GET', path, False, None)
  File "/Library/Python/2.7/site-packages/osmapi/OsmApi.py", line 1959, in _http
    "Give up after %s retries" % i
osmapi.OsmApi.MaximumRetryLimitReachedError: Give up after 5 retries
[Errno 8] nodename nor servname provided, or not known

Process finished with exit code 1
metaodi commented 7 years ago

@hanchao thank you for reporting an issue and sorry for getting back to you so late.

Are you running the OSM API on localhost? Can you try it like this:

api = osmapi.OsmApi(api="http://localhost:3000")
print api.Capabilities()

The "http://" is important for osmapi to connect to the API.

metaodi commented 7 years ago

I'm closing this for now, as I think the missing "http://" caused this issue. Please comment/re-open if you think this is not correct.