Rest Client Usage

The rest_client module

class ResponseBody(response, body=None)[source]

Class that wraps an http response and dict body into a single value.

Callers that receive this object will normally use it as a dict but can extract the response if needed.

class ResponseBodyData(response, data)[source]

Class that wraps an http response and string data into a single value.

class ResponseBodyList(response, body=None)[source]

Class that wraps an http response and list body into a single value.

Callers that receive this object will normally use it as a list but can extract the response if needed.

class RestClient(auth_provider, service, region, endpoint_type='publicURL', build_interval=1, build_timeout=60, disable_ssl_certificate_validation=False, ca_certs=None, trace_requests='', name=None, http_timeout=None, proxy_url=None, follow_redirects=True)[source]

Unified OpenStack RestClient class

This class is used for building openstack api clients on top of. It is intended to provide a base layer for wrapping outgoing http requests in keystone auth as well as providing response code checking and error handling.

Parameters:
  • auth_provider – an auth provider object used to wrap requests in auth

  • service (str) – The service name to use for the catalog lookup

  • region (str) – The region to use for the catalog lookup

  • name (str) – The endpoint name to use for the catalog lookup; this returns only if the service exists

  • endpoint_type (str) – The endpoint type to use for the catalog lookup

  • build_interval (int) – Time in seconds between to status checks in wait loops

  • build_timeout (int) – Timeout in seconds to wait for a wait operation.

  • disable_ssl_certificate_validation (bool) – Set to true to disable ssl certificate validation

  • ca_certs (str) – File containing the CA Bundle to use in verifying a TLS server cert

  • trace_requests (str) – Regex to use for specifying logging the entirety of the request and response payload

  • http_timeout (str) – Timeout in seconds to wait for the http request to return

  • proxy_url (str) – http proxy url to use.

  • follow_redirects (bool) – Set to false to stop following redirects.