1import os
2def set_proxy():
3 proxy_addr = 'http://{user}:{passwd}@{address}:{port}'.format(
4 user='user_example', passwd='pass_example',
5 address='address_example', port=int('port_example'))
6 os.environ['http_proxy'] = proxy_addr
7 os.environ['https_proxy'] = proxy_addr
8
9def unset_proxy():
10 os.environ.pop('http_proxy')
11 os.environ.pop('https_proxy')
12
13set_proxy()
14geolocator = GoogleV3()
15location = geolocator.geocode('%s, %s' % (latitude, longitude), timeout=10)
16address = location.address
17unset_proxy()