Construct the geocoder with its own route:

from urllib.parse import quote
from geopy.geocoders import GoogleV3

account = quote(proxy_user, safe='') + ':' + quote(proxy_password, safe='')
proxy_url = f'http://{account}@proxy.example:8080'
geocoder = GoogleV3(
    api_key=google_api_key,
    proxies={'http': proxy_url, 'https': proxy_url},
    timeout=10,
)

The application supplies both accounts. google_api_key authorizes Google geocoding; the URL username and password authorize the proxy. Encode those raw components once, leaving structural URL separators outside the encoding.

proxies valuegeopy policy
NonePermit system discovery
{}Select direct access
Nonempty mappingSelect the supplied route

The https key matches HTTPS destinations carried through the HTTP proxy. geopy's documented interface supports HTTP proxying, including CONNECT; a spelling of https does not itself establish TLS to the listener.

Reuse the geocoder with that stable policy. Switching environment values around individual calls can interfere with another geocoder working concurrently.

Mikanda mikatakata