def __init__(self, access_token=None, **kwargs):
        """Initialize the Handler object with country name list and the cache initialized."""
        self.access_token = access_token
        self.countries = self._read_country_names(kwargs.get('countries_file'))

        self.request_options = kwargs.get('request_options', {})
        if 'timeout' not in self.request_options:
            self.request_options['timeout'] = self.REQUEST_TIMEOUT_DEFAULT

        if 'cache' in kwargs:
            self.cache = kwargs['cache']
        else:
            cache_options = kwargs.get('cache_options', {})
            maxsize = cache_options.get('maxsize', self.CACHE_MAXSIZE)
            ttl = cache_options.get('ttl', self.CACHE_TTL)
            self.cache = DefaultCache(maxsize, ttl, **cache_options)
def __init__ ( self , access_token = None , ** kwargs ) : self . access_token = access_token self . countries = self . _read_country_names ( kwargs . get ( 'countries_file' ) ) self . request_options = kwargs . get ( 'request_options' , { } ) if 'timeout' not in self . request_options : self . request_options [ 'timeout' ] = self . REQUEST_TIMEOUT_DEFAULT if 'cache' in kwargs : self . cache = kwargs [ 'cache' ] else : cache_options = kwargs . get ( 'cache_options' , { } ) maxsize = cache_options . get ( 'maxsize' , self . CACHE_MAXSIZE ) ttl = cache_options . get ( 'ttl' , self . CACHE_TTL ) self . cache = DefaultCache ( maxsize , ttl , ** cache_options )
Initialize the Handler object with country name list and the cache initialized.