The heat.common.client Module

class heat.common.client.BaseClient(host=None, port=None, use_ssl=False, auth_tok=None, creds=None, doc_root=None, key_file=None, cert_file=None, ca_file=None, insecure=False, configure_via_auth=True, service_type=None)[source]

Bases: object

A base client class

DEFAULT_CA_FILE_PATH = '/etc/ssl/certs/ca-certificates.crt:/etc/pki/tls/certs/ca-bundle.crt:/etc/ssl/ca-bundle.pem:/etc/ssl/cert.pem'
DEFAULT_DOC_ROOT = None
DEFAULT_PORT = 80
OK_RESPONSE_CODES = (200, 201, 202, 204)
REDIRECT_RESPONSE_CODES = (301, 302, 303, 305, 307)
configure_from_url(url)[source]

Setups the connection based on the given url.

The form is:

<http|https>://<host>:port/doc_root
do_request(*args, **kwargs)[source]

Make a request, returning an HTTP response object.

Parameters:
  • method – HTTP verb (GET, POST, PUT, etc.)
  • action – Requested path to append to self.doc_root
  • body – Data to send in the body of the request
  • headers – Headers to send with the request
  • params – Key/value pairs to use in query string
Returns:

HTTP response object

get_connect_kwargs()[source]
get_connection_type()[source]

Returns the proper connection type

get_status_code(response)[source]

Returns the integer status code from the response, which can be either a Webob.Response (used in testing) or httplib.Response

image_iterator(connection, headers, body)[source]
make_auth_plugin(creds)[source]

Returns an instantiated authentication plugin.

set_auth_token(auth_tok)[source]

Updates the authentication token for this client connection.

class heat.common.client.HTTPSClientAuthConnection(host, port, key_file, cert_file, ca_file, timeout=None, insecure=False)[source]

Bases: httplib.HTTPSConnection

Class to make a HTTPS connection, with support for full client-based SSL Authentication

:see http://code.activestate.com/recipes/
577548-https-httplib-client-connection-with-certificate-v/
connect()[source]

Connect to a host on a given (SSL) port. If ca_file is pointing somewhere, use it to check Server Certificate.

Redefined/copied and extended from httplib.py:1105 (Python 2.6.x). This is needed to pass cert_reqs=ssl.CERT_REQUIRED as parameter to ssl.wrap_socket(), which forces SSL to check server certificate against our client certificate.

class heat.common.client.ImageBodyIterator(source)[source]

Bases: object

A class that acts as an iterator over an image file’s chunks of data. This is returned as part of the result tuple from heat.cfn_client.client.Client.get_image

heat.common.client.handle_redirects(func)[source]

Wrap the _do_request function to handle HTTP redirects.

heat.common.client.handle_unauthorized(func)[source]

Wrap a function to re-authenticate and retry.

This Page