Returns a dict to communicate with the server

        :param restrict_keys: a set of keys to restrict the returned data to
        :rtype: dict
8910
def to_api_data(self, restrict_keys=None):
        
        cc = self._cc  # alias
        data = {
            cc('column_hidden'): self._column_hidden,
            cc('row_hidden'): self._row_hidden,
            cc('formulas'): self._formulas,
            cc('formulas_local'): self._formulas_local,
            cc('formulas_r1_c1'): self._formulas_r1_c1,
            cc('number_format'): self._number_format,
            cc('values'): self._values,
        }

        if restrict_keys:
            for key in list(data.keys()):
                if key not in restrict_keys:
                    del data[key]
        return data
1056371
def generate_api_key(self):
        
        endpoint = '/'.join((self.server_url, '_api', 'v2', 'api_keys'))
        resp = self.r_session.post(endpoint)
        resp.raise_for_status()
        return response_to_json_dict(resp)
72742
def getsshkeys(self):
        
        request = requests.get(
            self.keys_url, headers=self.headers, verify=self.verify_ssl, auth=self.auth, timeout=self.timeout)

        if request.status_code == 200:
            return request.json()
        else:
            return False
1265260
def keypair():
    '''
    
    '''
    fields = [
        ('User ID', 'user_id'),
        ('Access Key', 'access_key'),
        ('Secret Key', 'secret_key'),
        ('Active?', 'is_active'),
        ('Admin?', 'is_admin'),
        ('Created At', 'created_at'),
        ('Last Used', 'last_used'),
        ('Res.Policy', 'resource_policy'),
        ('Rate Limit', 'rate_limit'),
        ('Concur.Limit', 'concurrency_limit'),
        ('Concur.Used', 'concurrency_used'),
    ]
    with Session() as session:
        try:
            kp = session.KeyPair(session.config.access_key)
            info = kp.info(fields=(item[1] for item in fields))
        except Exception as e:
            print_error(e)
            sys.exit(1)
        rows = []
        for name, key in fields:
            rows.append((name, info[key]))
        print(tabulate(rows, headers=('Field', 'Value')))
451475
def full_dict(ldict, keys):
    
    if type(keys) == str:
        keys = [keys]
    else:
        keys = keys

    cmp_dict = {}
    for line in ldict:
        index = []
        for key in keys:
            index.append(str(line.get(key, '')))
        index = '-'.join(index)
        cmp_dict[index] = line

    return cmp_dict
1060567
def getKeyConfig(self, keyID=None):
        
        k = keyID if keyID is not None else self._keyID
        if not k or k not in self._data['keys']:
            raise ConfigException('request key does not exist: %s' % k)
        return self._data['keys'][k]
1066968
def load(self):
        
        session_data = {}
        try:
            session_data = decode(self.session_key,
                settings.DJAODJIN_SECRET_KEY)
            self._session_key_data.update(session_data)
            LOGGER.debug("session data (from proxy): %s", session_data)
            # We have been able to decode the session data, let's
            # create Users and session keys expected by Django
            # contrib.auth backend.
            if 'username' in session_data:
                user = authenticate(
                    request=session_data, remote_user=session_data['username'])
                if not user:
                    raise ValueError("Cannot authenticate user.")
                session_data[SESSION_KEY] = user.id
                session_data[BACKEND_SESSION_KEY] = user.backend
                session_data[HASH_SESSION_KEY] = user.get_session_auth_hash()
                if self._local:
                    session_data_local = self._local.load()
                    LOGGER.debug("session data (local): %s", session_data_local)
                    session_data.update(session_data_local)
        except Exception as err: #pylint:disable=broad-except
            LOGGER.debug("error: while loading session, %s", err)
            return {}
        return session_data
803305
def to_dict(self):
        
        return {'access_key': self.access_key,
                'secret_key': self.secret_key,
                'session_token': self.session_token,
                'expiration': self.expiration,
                'request_id': self.request_id}
1373219
def get(security_token=None, key=None):
    
    if security_token is None:
        security_token = nago.core.get_my_info()['host_name']
    data = node_data.get(security_token, {})
    if not key:
        return data
    else:
        return data.get(key)
1339957
def server_to_dict(server):
    
    def get_ips_for_server(server):
        public_ips = []
        private_ips = []
        def address_is_public(address):
            return address['OS-EXT-IPS:type'] == 'floating'
        def address_is_private(address):
            return not address_is_public(address)

        for network, addresses in server.addresses.iteritems():
            # TODO: is this right? Can have private floating ips
            public = filter(address_is_public, addresses)
            private = filter(address_is_private, addresses)
            public_ips.extend(public)
            private_ips.extend(private)
        return private_ips, public_ips

    addresses = server.addresses
    pub = addresses.get('public', [])
    priv = addresses.get('private', [])

    if not pub and not priv:
        # Openstack 13.5?
        priv, pub = get_ips_for_server(server)

    return {
            A.server.ID: server.id,
            A.server.PUBLIC_IPS: [a['addr'] for a in pub],
            A.server.PRIVATE_IPS: [a['addr'] for a in priv],
            }
284220
def get(self, key):  
        
        res = self.connection.get(key)
        print(res)
        return res
340762
def dict(self):
        
        d = {p.key: getattr(self, p.key) for p in self.__mapper__.attrs
             if p.key not in ('table', 'stats', '_codes', 'data')}

        if not d:
            raise Exception(self.__dict__)

        d['schema_type'] = self.schema_type

        if self.data:
            # Copy data fields into top level dict, but don't overwrite existind values.
            for k, v in six.iteritems(self.data):
                if k not in d and k not in ('table', 'stats', '_codes', 'data'):
                    d[k] = v

        return d
136218
def keys(cls, name, hash_key, range_key=None, throughput=None):
        
        return cls(cls.KEYS, name, hash_key, range_key,
                   throughput=throughput)
446609
def getKey(self, key):
		
		data = self.getDictionary()
		if key in data:
			return data[key]
		else:
			return None
914713
def todict(self):
        
        return {"f_key": hb_encode(self.f_key),
                "alpha_key": hb_encode(self.alpha_key),
                "chunks": self.chunks,
                "encrypted": self.encrypted,
                "iv": hb_encode(self.iv),
                "hmac": hb_encode(self.hmac)}
201213
def get_blocked_usernames():
    
    if config.DISABLE_USERNAME_LOCKOUT:
        # There are no blocked usernames since we disabled them.
        return []
    key = get_username_blocked_cache_key("*")
    key_list = [redis_key.decode('utf-8')
                for redis_key in REDIS_SERVER.keys(key)]
    return strip_keys(key_list)
24548
def ssh_keys(self):
        
        params = {}
        json = self.request('/ssh_keys', method='GET', params=params)
        status = json.get('status')
        if status == 'OK':
            ssh_keys_json = json.get('ssh_keys', [])
            keys = [SSHKey.from_json(ssh_key) for ssh_key in ssh_keys_json]
            return keys
        else:
            message = json.get('message')
            raise DOPException('[%s]: %s' % (status, message))