keystoneauth1.session.
NoOpSemaphore
¶Bases: object
Empty context manager for use as a default semaphore.
keystoneauth1.session.
RequestTiming
(method, url, elapsed)¶Bases: object
Contains timing information for an HTTP interaction.
elapsed
= None¶Elapsed time information
method
= None¶HTTP method used for the call (GET, POST, etc)
url
= None¶URL against which the call was made
keystoneauth1.session.
Session
(auth=None, session=None, original_ip=None, verify=True, cert=None, timeout=None, user_agent=None, redirect=30, additional_headers=None, app_name=None, app_version=None, additional_user_agent=None, discovery_cache=None, split_loggers=None, collect_timing=False, rate_semaphore=None, connect_retries=0)¶Bases: object
Maintains client communication state and common functionality.
As much as possible the parameters to this class reflect and are passed
directly to the requests
library.
Parameters: |
|
---|
adapters
¶get_all_version_data
(auth=None, interface='public', region_name=None, service_type=None, **kwargs)¶Get version data for all services in the catalog.
Parameters: |
|
---|---|
Returns: | A dictionary keyed by region_name with values containing dictionaries keyed by interface with values being a list of ~keystoneauth1.discover.VersionData. |
get_api_major_version
(auth=None, **kwargs)¶Get the major API version as provided by the auth plugin.
Parameters: | auth (keystoneauth1.plugin.BaseAuthPlugin) – The auth plugin to use for token. Overrides the plugin on the session. (optional) |
---|---|
Raises: | keystoneauth1.exceptions.auth_plugins.MissingAuthPlugin – if a plugin is not available. |
Returns: | The major version of the API of the service discovered. |
Return type: | tuple or None |
get_auth_connection_params
(auth=None, **kwargs)¶Return auth connection params as provided by the auth plugin.
An auth plugin may specify connection parameters to the request like providing a client certificate for communication.
We restrict the values that may be returned from this function to prevent an auth plugin overriding values unrelated to connection parmeters. The values that are currently accepted are:
These values are passed to the requests library and further information on accepted values may be found there.
Parameters: | auth (keystoneauth1.plugin.BaseAuthPlugin) – The auth plugin to use for tokens. Overrides the plugin on the session. (optional) |
---|---|
Raises: |
|
Returns: | Authentication headers or None for failure. |
Return type: |
|
get_auth_headers
(auth=None, **kwargs)¶Return auth headers as provided by the auth plugin.
Parameters: | auth (keystoneauth1.plugin.BaseAuthPlugin) – The auth plugin to use for token. Overrides the plugin on the session. (optional) |
---|---|
Raises: |
|
Returns: | Authentication headers or None for failure. |
Return type: |
|
get_endpoint
(auth=None, **kwargs)¶Get an endpoint as provided by the auth plugin.
Parameters: | auth (keystoneauth1.plugin.BaseAuthPlugin) – The auth plugin to use for token. Overrides the plugin on the session. (optional) |
---|---|
Raises: | keystoneauth1.exceptions.auth_plugins.MissingAuthPlugin – if a plugin is not available. |
Returns: | An endpoint if available or None. |
Return type: | string |
get_endpoint_data
(auth=None, **kwargs)¶Get endpoint data as provided by the auth plugin.
Parameters: | auth (keystoneauth1.plugin.BaseAuthPlugin) – The auth plugin to use for token. Overrides the plugin on the session. (optional) |
---|---|
Raises: |
|
Returns: | Endpoint data if available or None. |
Return type: |
get_project_id
(auth=None)¶Return the authenticated project_id as provided by the auth plugin.
Parameters: | auth (keystoneauth1.plugin.BaseAuthPlugin) – The auth plugin to use for token. Overrides the plugin on the session. (optional) |
---|---|
Raises: |
|
Returns: | Current project_id or None if not supported by plugin. |
Return type: |
|
get_timings
()¶Return collected API timing information.
Returns: | List of RequestTiming objects. |
---|
get_token
(auth=None)¶Return a token as provided by the auth plugin.
Parameters: | auth (keystoneauth1.plugin.BaseAuthPlugin) – The auth plugin to use for token. Overrides the plugin on the session. (optional) |
---|---|
Raises: |
|
Warning
DEPRECATED: This assumes that the only header that is used to
authenticate a message is X-Auth-Token
. This may not be
correct. Use get_auth_headers()
instead.
Returns: | A valid token. |
---|---|
Return type: | string |
get_user_id
(auth=None)¶Return the authenticated user_id as provided by the auth plugin.
Parameters: | auth (keystoneauth1.plugin.BaseAuthPlugin) – The auth plugin to use for token. Overrides the plugin on the session. (optional) |
---|---|
Raises: |
|
Returns: | Current user_id or None if not supported by plugin. |
Return type: |
|
invalidate
(auth=None)¶Invalidate an authentication plugin.
Parameters: | auth (keystoneauth1.plugin.BaseAuthPlugin) – The auth plugin to invalidate. Overrides the plugin on the session. (optional) |
---|
mount
(scheme, adapter)¶request
(url, method, json=None, original_ip=None, user_agent=None, redirect=None, authenticated=None, endpoint_filter=None, auth=None, requests_auth=None, raise_exc=True, allow_reauth=True, log=True, endpoint_override=None, connect_retries=None, logger=None, allow=None, client_name=None, client_version=None, microversion=None, microversion_service_type=None, status_code_retries=0, retriable_status_codes=None, rate_semaphore=None, global_request_id=None, connect_retry_delay=None, status_code_retry_delay=None, **kwargs)¶Send an HTTP request with the specified characteristics.
Wrapper around requests.Session.request to handle tasks such as setting headers, JSON encoding/decoding, and error handling.
Arguments that are not handled are passed through to the requests library.
Parameters: |
|
---|---|
Raises: | keystoneauth1.exceptions.base.ClientException – For connection failure, or to indicate an error response code. |
Returns: | The response to the request. |
reset_timings
()¶Clear API timing information.
user_agent
= None¶keystoneauth1.session.
TCPKeepAliveAdapter
(pool_connections=10, pool_maxsize=10, max_retries=0, pool_block=False)¶Bases: requests.adapters.HTTPAdapter
The custom adapter used to set TCP Keep-Alive on all connections.
This Adapter also preserves the default behaviour of Requests which disables Nagle’s Algorithm. See also: https://blogs.msdn.com/b/windowsazurestorage/archive/2010/06/25/nagle-s-algorithm-is-not-friendly-towards-small-requests.aspx
init_poolmanager
(*args, **kwargs)¶Initializes a urllib3 PoolManager.
This method should not be called from user code, and is only
exposed for use when subclassing the
HTTPAdapter
.
Parameters: |
|
---|
Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.