def __init__(
            self,
            format_string=None,
            scheme=None,
            timeout=DEFAULT_SENTINEL,
            proxies=DEFAULT_SENTINEL,
            user_agent=None,
            ssl_context=DEFAULT_SENTINEL,
    ):
        """
        Mostly-common geocoder validation, proxies, &c. Not all geocoders
        specify format_string and such.
        """
        self.format_string = format_string or options.default_format_string
        self.scheme = scheme or options.default_scheme
        if self.scheme not in ('http', 'https'):
            raise ConfigurationError(
                'Supported schemes are `http` and `https`.'
            )
        self.timeout = (timeout if timeout is not DEFAULT_SENTINEL
                        else options.default_timeout)
        self.proxies = (proxies if proxies is not DEFAULT_SENTINEL
                        else options.default_proxies)
        self.headers = {'User-Agent': user_agent or options.default_user_agent}
        self.ssl_context = (ssl_context if ssl_context is not DEFAULT_SENTINEL
                            else options.default_ssl_context)

        if isinstance(self.proxies, string_compare):
            self.proxies = {'http': self.proxies, 'https': self.proxies}

        # `ProxyHandler` should be present even when actually there're
        # no proxies. `build_opener` contains it anyway. By specifying
        # it here explicitly we can disable system proxies (i.e.
        # from HTTP_PROXY env var) by setting `self.proxies` to `{}`.
        # Otherwise, if we didn't specify ProxyHandler for empty
        # `self.proxies` here, build_opener would have used one internally
        # which could have unwillingly picked up the system proxies.
        opener = build_opener_with_context(
            self.ssl_context,
            ProxyHandler(self.proxies),
        )
        self.urlopen = opener.open
def __init__ ( self , format_string = None , scheme = None , timeout = DEFAULT_SENTINEL , proxies = DEFAULT_SENTINEL , user_agent = None , ssl_context = DEFAULT_SENTINEL , ) : self . format_string = format_string or options . default_format_string self . scheme = scheme or options . default_scheme if self . scheme not in ( 'http' , 'https' ) : raise ConfigurationError ( 'Supported schemes are `http` and `https`.' ) self . timeout = ( timeout if timeout is not DEFAULT_SENTINEL else options . default_timeout ) self . proxies = ( proxies if proxies is not DEFAULT_SENTINEL else options . default_proxies ) self . headers = { 'User-Agent' : user_agent or options . default_user_agent } self . ssl_context = ( ssl_context if ssl_context is not DEFAULT_SENTINEL else options . default_ssl_context ) if isinstance ( self . proxies , string_compare ) : self . proxies = { 'http' : self . proxies , 'https' : self . proxies } opener = build_opener_with_context ( self . ssl_context , ProxyHandler ( self . proxies ) , ) self . urlopen = opener . open
Mostly-common geocoder validation, proxies, &c. Not all geocoders
        specify format_string and such.