Get Client

        Get information about a single client.

        This method gives output: ``v1/get-client-response.json#``

        This method is ``stable``
960587
def client(self, *args, **kwargs):
        

        return self._makeApiCall(self.funcinfo["client"], *args, **kwargs)
655791
def _get_response(self):
        
        try:
            self._open_connection()
            if self.connection is None:
                # The connection wasn't opened, which means we're deferring a reconnection attempt.
                # Raise a socket.error, so we'll return the same server_disconnected message as we
                # do below.
                raise socket.error('Delaying reconnection attempt')

            header = self._read_socket(self.HEADER_SIZE)
            (magic, opcode, keylen, extlen, datatype, status, bodylen, opaque,
             cas) = struct.unpack(self.HEADER_STRUCT, header)

            assert magic == self.MAGIC['response']

            extra_content = None
            if bodylen:
                extra_content = self._read_socket(bodylen)

            return (magic, opcode, keylen, extlen, datatype, status, bodylen,
                    opaque, cas, extra_content)
        except socket.error as e:
            self._connection_error(e)

            # (magic, opcode, keylen, extlen, datatype, status, bodylen, opaque, cas, extra_content)
            message = str(e)
            return (self.MAGIC['response'], -1, 0, 0, 0, self.STATUS['server_disconnected'], 0, 0, 0, message)
338837
def _get_client_from_cache(self, client_id):
        
        data = self._read_uaa_cache()

        # Only if we've cached any for this issuer
        if self.uri not in data:
            return

        for client in data[self.uri]:
            if client['id'] == client_id:
                return client
178075
def get_clients(self, limit=None, offset=None):
        
        data = {}
        if limit:
            data['limit'] = limit
        if offset:
            data['offset'] = offset
        result = self._request('GET', '/clients', data=json.dumps(data))
        return result.json()
287285
def get_new_client(self, public=True):
        
        return self._get_client(public=public, cached=False)
1199279
def get_client_nowait(self):
        
        if self.__sem is not None:
            if self.__sem._value == 0:
                return None
            self.__sem.acquire()
        _, client = self._get_client_from_pool_or_make_it()
        return client
622754
function get_client() {
		if (client_cache) return Promise.resolve(client_cache);
		return make_promise(
			cypher.createClient.bind(cypher, connection_string, connection_opts)
		).then(cache_client);
	}
564633
def _get_client(self, server):
        
        return Client(
            server=server[0],
            authport=server[1],
            secret=server[2],
            dict=self._get_dictionary(),
        )
877149
def get_status(self):
        
        logger.debug("get server status")
        server_status = ctypes.c_int()
        cpu_status = ctypes.c_int()
        clients_count = ctypes.c_int()
        error = self.library.Srv_GetStatus(self.pointer, ctypes.byref(server_status),
                                           ctypes.byref(cpu_status),
                                           ctypes.byref(clients_count))
        check_error(error)
        logger.debug("status server %s cpu %s clients %s" %
                     (server_status.value, cpu_status.value,
                      clients_count.value))
        return snap7.snap7types.server_statuses[server_status.value], \
               snap7.snap7types.cpu_statuses[cpu_status.value], \
               clients_count.value
1365030
def events_client(self, client):
        
        # TODO Add paging to this
        client = self._client_id(client)
        response = self._get(url.events_clients_id.format(id=client))
        self._check_response(response, 200)
        return self._create_response(response).get("events")
405953
def get_result(self, client, check):
        
        data = self._request('GET', '/results/{}/{}'.format(client, check))
        return data.json()
645128
def _get_client(self):
        
        kwargs = self._storage_parameters

        # Handles unsecure mode
        if self._unsecure:
            kwargs = kwargs.copy()
            kwargs['ssl_compression'] = False

        return _swift.client.Connection(**kwargs)
965212
def get_client_info(self, obj):
        
        info = self.get_base_info(obj)

        default_contact_info = {}
        default_contact = self.get_default_contact(client=obj)
        if default_contact:
            default_contact_info = self.get_contact_info(default_contact)

        info.update({
            "default_contact": default_contact_info
        })

        # UID of the client
        uid = api.get_uid(obj)

        # Bika Setup folder
        bika_setup = api.get_bika_setup()

        # bika samplepoints
        bika_samplepoints = bika_setup.bika_samplepoints
        bika_samplepoints_uid = api.get_uid(bika_samplepoints)

        # bika artemplates
        bika_artemplates = bika_setup.bika_artemplates
        bika_artemplates_uid = api.get_uid(bika_artemplates)

        # bika analysisprofiles
        bika_analysisprofiles = bika_setup.bika_analysisprofiles
        bika_analysisprofiles_uid = api.get_uid(bika_analysisprofiles)

        # bika analysisspecs
        bika_analysisspecs = bika_setup.bika_analysisspecs
        bika_analysisspecs_uid = api.get_uid(bika_analysisspecs)

        # catalog queries for UI field filtering
        filter_queries = {
            "contact": {
                "getParentUID": [uid]
            },
            "cc_contact": {
                "getParentUID": [uid]
            },
            "invoice_contact": {
                "getParentUID": [uid]
            },
            "samplepoint": {
                "getClientUID": [uid, bika_samplepoints_uid],
            },
            "artemplates": {
                "getClientUID": [uid, bika_artemplates_uid],
            },
            "analysisprofiles": {
                "getClientUID": [uid, bika_analysisprofiles_uid],
            },
            "analysisspecs": {
                "getClientUID": [uid, bika_analysisspecs_uid],
            },
            "samplinground": {
                "getParentUID": [uid],
            },
            "sample": {
                "getClientUID": [uid],
            },
        }
        info["filter_queries"] = filter_queries

        return info
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
438697
def client_id(self, client):
        

        params = {
            "name": client
        }

        response = self._get(url.clients, params=params)
        self._check_response(response, 200)
        return self._create_response(response).get("client_id")
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))
123401
def get_client(self, client_id):
        
        self.assert_has_permission('clients.read')

        uri = self.uri + '/oauth/clients/' + client_id
        headers = self.get_authorization_headers()
        response = requests.get(uri, headers=headers)
        if response.status_code == 200:
            return response.json()
        else:
            # Not found but don't raise
            return