The keystoneclient.client Module

OpenStack Client interface. Handles the REST calls and responses.

class keystoneclient.client.HTTPClient(username=None, tenant_id=None, tenant_name=None, password=None, auth_url=None, region_name=None, timeout=None, endpoint=None, token=None, cacert=None, key=None, cert=None, insecure=False, original_ip=None, debug=False, auth_ref=None, use_keyring=False, force_new_token=False, stale_duration=None)

Bases: object

USER_AGENT = 'python-keystoneclient'
auth_token
authenticate(username=None, password=None, tenant_name=None, tenant_id=None, auth_url=None, token=None)

Authenticate user.

Uses the data provided at instantiation to authenticate against the Keystone server. This may use either a username and password or token for authentication. If a tenant name or id was provided then the resulting authenticated client will be scoped to that tenant and contain a service catalog of available endpoints.

With the v2.0 API, if a tenant name or ID is not provided, the authenication token returned will be ‘unscoped’ and limited in capabilities until a fully-scoped token is acquired.

If successful, sets the self.auth_ref and self.auth_token with the returned token. If not already set, will also set self.management_url from the details provided in the token.

Returns:True if authentication was successful.
Raises :AuthorizationFailure if unable to authenticate or validate the existing authorization token
Raises :ValueError if insufficient parameters are used.

If keyring is used, token is retrieved from keyring instead. Authentication will only be necessary if any of the following conditions are met:

  • keyring is not used
  • if token is not found in keyring
  • if token retrieved from keyring is expired or about to expired (as determined by stale_duration)
  • if force_new_token is true
delete(url, **kwargs)
get(url, **kwargs)
get_auth_ref_from_keyring(auth_url, username, tenant_name, tenant_id, token)

Retrieve auth_ref from keyring.

If auth_ref is found in keyring, (keyring_key, auth_ref) is returned. Otherwise, (keyring_key, None) is returned.

Returns:(keyring_key, auth_ref) or (keyring_key, None)
get_raw_token_from_identity_service(auth_url, username=None, password=None, tenant_name=None, tenant_id=None, token=None)

Authenticate against the Identity API and get a token.

Not implemented here because auth protocols should be API version-specific.

Expected to authenticate or validate an existing authentication reference already associated with the client. Invoking this call always makes a call to the Keystone.

Returns:raw token
head(url, **kwargs)
http_log_req(args, kwargs)
http_log_resp(resp)
patch(url, **kwargs)
post(url, **kwargs)
process_token()

Extract and process information from the new auth_ref.

put(url, **kwargs)
request(url, method, **kwargs)

Send an http request with the specified characteristics.

Wrapper around requests.request to handle tasks such as setting headers, JSON encoding/decoding, and error handling.

serialize(entity)
store_auth_ref_into_keyring(keyring_key)

Store auth_ref into keyring.

keystoneclient.client.try_import_keyring()

Previous topic

The keystoneclient.base Module

Next topic

The keystoneclient.common.cms Module

This Page