Get an API client (with configuration).
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
871615
def create_api_client(api='BatchV1'):
    
    k8s_config.load_incluster_config()
    api_configuration = client.Configuration()
    api_configuration.verify_ssl = False
    if api == 'extensions/v1beta1':
        api_client = client.ExtensionsV1beta1Api()
    elif api == 'CoreV1':
        api_client = client.CoreV1Api()
    elif api == 'StorageV1':
        api_client = client.StorageV1Api()
    else:
        api_client = client.BatchV1Api()
    return api_client
605062
def get_client(self):
        
        context = self.context
        parent = api.get_parent(context)
        if context.portal_type == "Client":
            return context
        elif parent.portal_type == "Client":
            return parent
        elif context.portal_type == "Batch":
            return context.getClient()
        elif parent.portal_type == "Batch":
            return context.getClient()
        return None
1170588
def api_config(path):
    '''
    
    '''
    # Let's grab a copy of salt-api's required defaults
    opts = DEFAULT_API_OPTS.copy()

    # Let's override them with salt's master opts
    opts.update(client_config(path, defaults=DEFAULT_MASTER_OPTS.copy()))

    # Let's set the pidfile and log_file values in opts to api settings
    opts.update({
        'pidfile': opts.get('api_pidfile', DEFAULT_API_OPTS['api_pidfile']),
        'log_file': opts.get('api_logfile', DEFAULT_API_OPTS['api_logfile']),
    })

    prepend_root_dir(opts, [
        'api_pidfile',
        'api_logfile',
        'log_file',
        'pidfile'
    ])
    return opts
764791
def client(self, client_name, **params):
        """"""
        if client_name not in self.cfg.clients:
            raise OAuthException('Unconfigured client: %s' % client_name)

        if client_name not in ClientRegistry.clients:
            raise OAuthException('Unsupported services: %s' % client_name)

        params = dict(self.cfg.clients[client_name], **params)
        return ClientRegistry.clients[client_name](**params)
46265
def client(cls, config):
        
        if not hasattr(cls, "_client"):
            cls._client = statsd.StatsClient(config.STATSD_HOST, config.STATSD_PORT, config.STATSD_PREFIX)
        return cls._client
520516
def create_api_equipment(self):
        """"""
        return ApiEquipment(
            self.networkapi_url,
            self.user,
            self.password,
            self.user_ldap)
670603
def get(self, client_method, get_params, is_json=True):
        """"""
        url = self._wa.apollo_url + self.CLIENT_BASE + client_method
        headers = {}

        response = requests.get(url, headers=headers,
                                verify=self.__verify, params=get_params,
                                **self._request_args)
        if response.status_code == 200:
            if is_json:
                data = response.json()
                return self._scrub_data(data)
            else:
                return response.text
        # @see self.body for HTTP response body
        raise Exception("Unexpected response from apollo %s: %s" %
                        (response.status_code, response.text))
1343723
def api_get(self, action, data, headers=None):
        
        return self._api_request(action, data, 'GET', headers)
1279202
def _update_api_client(self, api_parent_class=None):
        """"""
        clients = ([self.api_clients[api_parent_class]]
                   if api_parent_class else self.api_clients.values())

        for api_client in clients:
            api_client.configuration.host = (self.config.get('host') or
                                             api_client.configuration.host)
            api_client.configuration.api_key['Authorization'] = self.config['api_key']
595223
def get(cls, id):
        '''
        
        '''
        client = cls._new_api_client()
        return client.make_request(cls, 'get', url_params={'id': id})
1131535
public Rcli<CLIENT> client(String apiVersion) throws CadiException {
		Rcli<CLIENT> client = clients.get(apiVersion);
		if(client==null) {
			client = rclient(initURI(),ss);
			client.apiVersion(apiVersion)
				  .readTimeout(connTimeout);
			clients.put(apiVersion, client);
		} 
		return client;
	}
970695
def _api_get(self):
        
        json = self._client.get(type(self).api_endpoint, model=self)
        self._populate(json)
1083064
def get(self, key, transaction=None):
    """"""
    return self._client.get(key, transaction=transaction)
815139
def create_client():
    """"""
    result = False
    if g.client_id in drivers:
        result = True
    return jsonify({'Success': result})
1080621
def get_api_service(self, name=None):
        """"""
        try:
            svc = self.services_by_name.get(name, None)
            if svc is None:
                raise ValueError(f"Couldn't find the API service configuration")
            return svc
        except:  # NOQA
            raise Exception(f"Failed to retrieve the API service configuration")
1000299
def create_api_context(self, cls):
        """"""
        return self.api_context_schema().load({
            "name": cls.name,
            "cls": cls,
            "inst": [],
            "conf": self.conf.get_api_service(cls.name),
            "calls": self.conf.get_api_calls(),
            "shared": {},  # Used per-API to monitor state
            "log_level": self.conf.get_log_level(),
            "callback": self.receive
            })