geopy code example
Example: geopy set proxy
import os
def set_proxy():
proxy_addr = 'http://{user}:{passwd}@{address}:{port}'.format(
user='user_example', passwd='pass_example',
address='address_example', port=int('port_example'))
os.environ['http_proxy'] = proxy_addr
os.environ['https_proxy'] = proxy_addr
def unset_proxy():
os.environ.pop('http_proxy')
os.environ.pop('https_proxy')
set_proxy()
geolocator = GoogleV3()
location = geolocator.geocode('%s, %s' % (latitude, longitude), timeout=10)
address = location.address
unset_proxy()