Get API key details.
6534
def find_by_id(key: str, user: str=None) -> Optional['ApiKey']:
        
        return ApiKey.from_db(db.get_key(key, user))
951460
def _get(self, q, params=''):
        ''''''
        if (q[-1] == '/'): q = q[:-1]
        headers = {'Content-Type': 'application/json'}
        r = requests.get('{url}{q}?api_key={key}{params}'.format(url=self.url, q=q, key=self.api_key, params=params),
                        headers=headers)
        ret = DotDict(r.json())
        if (not r.ok or ('error' in ret and ret.error == True)):
            raise Exception(r.url, r.reason, r.status_code, r.json())
        return DotDict(r.json())
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")
1235454
def get_keys(self, keymap):
        """"""
        keys = dict(modifiers=[], regular=[])

        # loop on keymap bytes
        for keymap_index, keymap_byte in enumerate(keymap):
            try:
                keymap_values = self._keymap_values_dict[keymap_index]
            except KeyError:
                continue

            # loop on keymap_values for that keymap byte
            for key, value in keymap_values.items():
                if not keymap_byte & key:
                    continue
                elif value in self._modifiers:
                    keys['modifiers'].append(value)
                elif not keys['regular']:
                    keys['regular'].append(value)

        return keys
1095637
def to_api(in_dict, int_keys=None, date_keys=None, bool_keys=None):
    """"""

    # Cast all int_keys to int()
    if int_keys:
        for in_key in int_keys:
            if (in_key in in_dict) and (in_dict.get(in_key, None) is not None):
                in_dict[in_key] = int(in_dict[in_key])

    # Cast all date_keys to datetime.isoformat
    if date_keys:
        for in_key in date_keys:
            if (in_key in in_dict) and (in_dict.get(in_key, None) is not None):

                _from = in_dict[in_key]

                if isinstance(_from, basestring):
                    dtime = parse_datetime(_from)

                elif isinstance(_from, datetime):
                    dtime = _from

                in_dict[in_key] = dtime.isoformat()

            elif (in_key in in_dict) and in_dict.get(in_key, None) is None:
                del in_dict[in_key]

    # Remove all Nones
    for k, v in in_dict.items():
        if v is None:
            del in_dict[k]

    return in_dict
349934
def get_api_key(key, request_options = {})
      client.get(Protocol.index_key_uri(name, key), :read, request_options)
    end
288617
def get_place_details(api_key, place_id, **kwargs):
    

    params = {
        'placeid': place_id,
        'key': api_key,
        }

    resp = requests.get(url=DETAIL_GOOGLEMAPS_API_URL, params=params)

    if resp.status_code >= 300:
        raise Exception('Bad status code rerieved from google api')

    data = json.loads(resp.text)

    # check api response status codess
    check_response_code(data)

    detail = data.get("result", {})

    place_identifier = "{} {}".format(detail.get("name"), detail.get("formatted_address"))

    detail_json = {
        "id": detail.get("place_id"),
        "name": detail.get("name"),
        "address": detail.get("formatted_address"),
        "types": detail.get("types"),
        "coordinates": detail.get("geometry", {}).get("location")
    }

    detail_json = add_optional_parameters(
        detail_json, detail,
        *get_populartimes_from_search(place_identifier, **kwargs)
    )

    return detail_json
802760
function getKeyDetailsString (key, redisConnection, data, next) {
  redisConnection.get(key, function (err, val) {
    if (err) {
      api.log('getRedisString: ' + err, 'error');
    }

    var details = {
      key: key,
      type: 'string',
      value: val
    };
    
    data.response.details = details;
    next();
  });
}
1367142
def is_valid_api_key(self):
        
        res = self.send('api/v3/api_keys', 'get')
        return \
            res.ok and \
            self.api_key in (ak['token'] for ak in res.json()['result'])
41991
def _getParameters(self):
        """"""
        param = self.query._getParameters()                   
        param[self.__key] =  self.__value
        return param
455542
def authenticate(self, api_key):
        """"""
        self._api_key = api_key

        # Attach auth to session.
        self._session.auth = ('', self._api_key)

        return self._verify_api_key()
1008837
def get_info(self, key=None, Id=None) -> dict:
        """"""
        if key is not None:
            Id = self[key].Id
        return self.infos.get(Id,{})
63506
async def async_get_api_key(session, host, port, username=None, password=None, **kwargs):
    """"""
    url = 'http://{host}:{port}/api'.format(host=host, port=str(port))

    auth = None
    if username and password:
        auth = aiohttp.BasicAuth(username, password=password)

    data = b'{"devicetype": "pydeconz"}'
    response = await async_request(session.post, url, auth=auth, data=data)

    api_key = response[0]['success']['username']
    _LOGGER.info("API key: %s", api_key)
    return api_key
820704
def get(cls):
        
        apikey = cls.__api_key or cls.__api_key_env_var

        if apikey:
            return apikey
        else:
            raise APIKeyMissingError("API key not set")
163031
def api_key(request, response, verify_user, context=None, **kwargs):
    
    api_key = request.get_header('X-Api-Key')

    if api_key:
        try:
            user = verify_user(api_key)
        except TypeError:
            user = verify_user(api_key, context)
        if user:
            return user
        else:
            return False
    else:
        return None
645587
def _get_query(self, query, params):
        
        if "apikey" not in params:
            params["apikey"] = self.api_key

        response = requests.get(query, params=params)
        return response.json()
166004
def api_keys(self, serverid, api_key):
        
        if serverid and api_key:
            self.can_query = True # Yes, we _are_ (will be) configured
        self.serverid = int(serverid)
        self.api_key = api_key
        self.webhook_url = self.__base_url + str(self.serverid) + '/' + self.api_key