Get drive API client based on settings.
186049
def get_drive_api():
    
    settings = Settings()

    if settings.credentials:
        return get_drive_api_from_file(settings.credentials_path)

    if settings.client_secrets:
        return get_drive_api_from_client_secrets(settings.client_secrets_path)
502102
def get_client_settings_config_file(**kwargs):  # pylint: disable=inconsistent-return-statements
    
    config_files = ['/etc/softlayer.conf', '~/.softlayer']
    if kwargs.get('config_file'):
        config_files.append(kwargs.get('config_file'))
    config_files = [os.path.expanduser(f) for f in config_files]
    config = utils.configparser.RawConfigParser({
        'username': '',
        'api_key': '',
        'endpoint_url': '',
        'timeout': '0',
        'proxy': '',
    })
    config.read(config_files)

    if config.has_section('softlayer'):
        return {
            'endpoint_url': config.get('softlayer', 'endpoint_url'),
            'timeout': config.getfloat('softlayer', 'timeout'),
            'proxy': config.get('softlayer', 'proxy'),
            'username': config.get('softlayer', 'username'),
            'api_key': config.get('softlayer', 'api_key'),
        }
1320074
def file_client(self):
        '''
        
        '''
        if not self._file_client:
            self._file_client = salt.fileclient.get_file_client(
                self.opts, self.pillar_rend)
        return self._file_client
1279438
def _get_drive_api(credentials):
    
    http = httplib2.Http()
    http = credentials.authorize(http)
    service = discovery.build('drive', 'v2', http=http)
    service.credentials = credentials  # duck punch service obj. with credentials
    return service
814244
def GetClientStates(self, client_list, client_chunk=50):
    """"""
    for client_group in collection.Batch(client_list, client_chunk):
      for fd in aff4.FACTORY.MultiOpen(
          client_group,
          mode="r",
          aff4_type=aff4_grr.VFSGRRClient,
          token=self.token):
        result = {}
        result["age"] = fd.Get(fd.Schema.PING)
        result["hostname"] = fd.Get(fd.Schema.HOSTNAME)
        yield (fd.urn, result)
1207378
def get_api(self, name=None):
        """"""
        if name is None:
            try:
                return self.conf.get("api").copy()
            except:  # NOQA
                raise Exception(f"Couldn't find the API configuration")
558376
def client_for(self, config_path, quiet=False, bootstrap_server=False,
                   create_client=False):
        """"""
        client = None
        abs_path = os.path.abspath(config_path)
        if abs_path in self.clients:
            client = self.clients[abs_path]
        elif create_client:
            client = self.create_client(config_path)
            if client.setup(quiet=quiet, bootstrap_server=bootstrap_server):
                self.clients[abs_path] = client
        return client
714814
def api(root_url, service, version, path):
    """"""
    root_url = root_url.rstrip('/')
    path = path.lstrip('/')
    if root_url == OLD_ROOT_URL:
        return 'https://{}.taskcluster.net/{}/{}'.format(service, version, path)
    else:
        return '{}/api/{}/{}/{}'.format(root_url, service, version, path)
177971
def get_api_client(cls):
    """"""
    config = cloudsmith_api.Configuration()
    client = cls()
    client.config = config
    client.api_client.rest_client = RestClient()

    user_agent = getattr(config, "user_agent", None)
    if user_agent:
        client.api_client.user_agent = user_agent

    headers = getattr(config, "headers", None)
    if headers:
        for k, v in six.iteritems(headers):
            client.api_client.set_default_header(k, v)

    return client
627447
def get_my_drive
      url = base_api_url + "/me/drive"
      @my_drive = JSON.parse(HTTParty.get(url,headers: set_headers).body)
    end
1232477
private DirectoryServiceClient decideClient(){
        DirectoryServiceClient client;
        switch (config.getClientType()) {
            case RESTFUL:
                client = restfulClient;
                break;
            case DUMMY:
                client = dummyClient;
                break;
            case IN_MEMORY:
                client = new DirectoryServiceInMemoryClient();
                break;
            case PROVIDED:
                DirectoryServiceClientProvider provider = clientProvider.get();
                if (provider != null) {
                    client = provider.getClient();
                } else {
                    throw new IllegalStateException("No DirectoryServiceClientProvider is set up for Client Type PROVIDED");
                }
                break;
            default:
                //don't support other client type now.
                throw new IllegalStateException("UNKNOWN Client Type " + config.getClientType());
        }
        return client;
    }
940438
def Get(self):
    """"""

    args = vfs_pb2.ApiGetFileDetailsArgs(
        client_id=self.client_id, file_path=self.path)
    data = self._context.SendRequest("GetFileDetails", args).file
    return File(client_id=self.client_id, data=data, context=self._context)
450473
def cli(ctx, path, renku_home, use_external_storage):
    """"""
    ctx.obj = LocalClient(
        path=path,
        renku_home=renku_home,
        use_external_storage=use_external_storage,
    )
837970
def get_file_client(opts, pillar=False):
    '''
    
    '''
    client = opts.get('file_client', 'remote')
    if pillar and client == 'local':
        client = 'pillar'
    return {
        'remote': RemoteClient,
        'local': FSClient,
        'pillar': PillarClient,
    }.get(client, RemoteClient)(opts)
179188
def get_client(site=None):
    """"""
    if 'CITRINATION_API_KEY' not in environ:
        raise ValueError("'CITRINATION_API_KEY' is not set as an environment variable")
    if not site:
        site = environ.get("CITRINATION_SITE", "https://citrination.com")
    return CitrinationClient(environ['CITRINATION_API_KEY'], site)
662179
def c(self):
        """"""
        if self._client is None:
            self._parse_settings()
            self._client = Rumetr(**self.settings)
        return self._client
426642
def refresh(self):
        

        if self.object_id is None:
            url = self.build_url(self._endpoints.get('default_drive'))
        else:
            url = self.build_url(
                self._endpoints.get('get_drive').format(id=self.object_id))

        response = self.con.get(url)
        if not response:
            return False

        drive = response.json()

        self._update_data({self._cloud_data_key: drive})
        return True