def __init__(self, api_key=None, cache=None, api_url=None,
                 use_cache=True, update_cache=True, cache_dir=None,
                 verifySSL=True,
                 oauth=None, configfile=None):

        """ Construct a new Client with the specified parameters.
        Unspecified parameters will be derived from the users ~/alveo.config
        file if present.

        :type api_key: :class:String
        :param api_key: the API key to use
        :type cache: :class:Cache
        :param cache: the Cache to use
        :type api_url: String
        :param api_url: the base URL for the API server used
        :type use_cache: Boolean
        :param use_cache: True to fetch available data from the
            cache database, False to always fetch data from the server
        :type update_cache: Boolean
        :param update_cache: True to update the cache database with
            downloaded data, False to never write to the cache
        :type verifySSL: Boolean
        :param verifySSL True to enforce checking of SSL certificates, False
            to disable checking (eg. for staging/testing servers)
        :type oauth: Dictionary
        :param oauth dictionary of configuation settings for oauth containing keys
            client_id, client_secret and redirect_url, default None means to use
            api_key instead
        :type configfile: String
        :param configfile File name to read configuration from, default ~/alveo.config

        :rtype: Client
        :returns: the new Client
        """

        config = self._read_config(configfile)
        # api_key, api_url args override config settings
        if api_key:
            self.api_key = api_key
        else:
            self.api_key = config.get('apiKey', None)

        if api_url:
            self.api_url = api_url
        else:
            self.api_url = config.get('base_url', None)

        #pyAlveo Cache Settings
        if use_cache is not None:
            self.use_cache = use_cache
        else:
            self.use_cache = config.get('use_cache', None)

        if cache_dir:
            self.cache_dir = cache_dir
        else:
            self.cache_dir = config.get('cache_dir', None)

        self.update_cache = update_cache

        # grab the default context
        self.context = config.get('context', CONTEXT)

        # configure a cache if we want to read or write to it
        if self.use_cache or self.update_cache:
            if cache is None or isinstance(cache, str):
                if 'max_age' in config:
                    self.cache = Cache(self.cache_dir, config['max_age'])
                else:
                    self.cache = Cache(self.cache_dir)
            else:
                self.cache = cache
        else:
            self.cache = None

        self.oauth = OAuth2(api_url=self.api_url,
                            oauth=oauth,
                            api_key=self.api_key,
                            verifySSL=verifySSL)
def __init__ ( self , api_key = None , cache = None , api_url = None , use_cache = True , update_cache = True , cache_dir = None , verifySSL = True , oauth = None , configfile = None ) : config = self . _read_config ( configfile ) if api_key : self . api_key = api_key else : self . api_key = config . get ( 'apiKey' , None ) if api_url : self . api_url = api_url else : self . api_url = config . get ( 'base_url' , None ) if use_cache is not None : self . use_cache = use_cache else : self . use_cache = config . get ( 'use_cache' , None ) if cache_dir : self . cache_dir = cache_dir else : self . cache_dir = config . get ( 'cache_dir' , None ) self . update_cache = update_cache self . context = config . get ( 'context' , CONTEXT ) if self . use_cache or self . update_cache : if cache is None or isinstance ( cache , str ) : if 'max_age' in config : self . cache = Cache ( self . cache_dir , config [ 'max_age' ] ) else : self . cache = Cache ( self . cache_dir ) else : self . cache = cache else : self . cache = None self . oauth = OAuth2 ( api_url = self . api_url , oauth = oauth , api_key = self . api_key , verifySSL = verifySSL )
Construct a new Client with the specified parameters.
        Unspecified parameters will be derived from the users ~/alveo.config
        file if present.

        :type api_key: :class:String
        :param api_key: the API key to use
        :type cache: :class:Cache
        :param cache: the Cache to use
        :type api_url: String
        :param api_url: the base URL for the API server used
        :type use_cache: Boolean
        :param use_cache: True to fetch available data from the
            cache database, False to always fetch data from the server
        :type update_cache: Boolean
        :param update_cache: True to update the cache database with
            downloaded data, False to never write to the cache
        :type verifySSL: Boolean
        :param verifySSL True to enforce checking of SSL certificates, False
            to disable checking (eg. for staging/testing servers)
        :type oauth: Dictionary
        :param oauth dictionary of configuation settings for oauth containing keys
            client_id, client_secret and redirect_url, default None means to use
            api_key instead
        :type configfile: String
        :param configfile File name to read configuration from, default ~/alveo.config

        :rtype: Client
        :returns: the new Client