gboeing / osmnx-examples

Gallery of OSMnx tutorials, usage examples, and feature demonstations.
https://osmnx.readthedocs.io
MIT License
1.52k stars 521 forks source link

Connection error (access from behind the proxy) #21

Closed sbushmanov closed 5 years ago

sbushmanov commented 5 years ago

The simple notebook 00-osmnx-features-demo.ipynb is not working due to connection error:

G = ox.graph_from_place('Piedmont, California, USA', network_type='drive')
fig, ax = ox.plot_graph(G)

ConnectionError: HTTPConnectionPool(host='overpass-api.de', port=80): Max retries exceeded with url: /api/interpreter (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7fd250542d30>: Failed to establish a new connection: [Errno 101] Network is unreachable',))
gboeing commented 5 years ago

@sbushmanov Errno 101 usually results from network configuration or port blocking on the client side. As you can see, the overpass api is up right now and I can confirm your code snippet is working fine this morning on my network.

sbushmanov commented 5 years ago

Is there a way to access the service via proxy?

The answer

import sys,os,os.path
os.environ['HTTP_PROXY']="proxy_address:port"
G = ox.graph_from_place('Piedmont, California, USA', network_type='drive')