libcloud package

Subpackages

Submodules

libcloud.httplib_ssl module

Subclass for httplib.HTTPSConnection with optional certificate name verification, depending on libcloud.security settings.

class libcloud.httplib_ssl.LibcloudBaseConnection[source]

Bases: object

Base connection class to inherit from.

Note: This class should not be instantiated directly.

http_proxy_used = False
proxy_host = None
proxy_password = None
proxy_port = None
proxy_scheme = None
proxy_username = None
set_http_proxy(proxy_url)[source]

Set a HTTP proxy which will be used with this connection.

Parameters:proxy_url (str) – Proxy URL (e.g. http://<hostname>:<port> without authentication and http://<username>:<password>@<hostname>:<port> for basic auth authentication information.
class libcloud.httplib_ssl.LibcloudHTTPConnection(*args, **kwargs)[source]

Bases: httplib.HTTPConnection, libcloud.httplib_ssl.LibcloudBaseConnection

class libcloud.httplib_ssl.LibcloudHTTPSConnection(*args, **kwargs)[source]

Bases: httplib.HTTPSConnection, libcloud.httplib_ssl.LibcloudBaseConnection

Subclass of HTTPSConnection which verifies certificate names if and only if CA certificates are available.

Constructor

ca_cert = None
connect()[source]

Connect

Checks if verification is toggled; if not, just call httplib.HTTPSConnection’s connect

verify = True

libcloud.pricing module

libcloud.pricing.get_pricing(driver_type, driver_name, pricing_file_path=None)[source]

Return pricing for the provided driver.

Parameters:
  • driver_type (str) – Driver type (‘compute’ or ‘storage’)
  • driver_name (str) – Driver name
  • pricing_file_path (str) – Custom path to a price file. If not provided it uses a default path.
Return type:

dict

Returns:

Dictionary with pricing where a key name is size ID and the value is a price.

libcloud.pricing.get_size_price(driver_type, driver_name, size_id)[source]

Return price for the provided size.

Parameters:
  • driver_type (str) – Driver type (‘compute’ or ‘storage’)
  • driver_name (str) – Driver name
  • size_id (str or int) – Unique size ID (can be an integer or a string - depends on the driver)
Return type:

float

Returns:

Size price.

libcloud.pricing.set_pricing(driver_type, driver_name, pricing)[source]

Populate the driver pricing dictionary.

Parameters:
  • driver_type (str) – Driver type (‘compute’ or ‘storage’)
  • driver_name (str) – Driver name
  • pricing (dict) – Dictionary where a key is a size ID and a value is a price.
libcloud.pricing.clear_pricing_data()[source]

Invalidate pricing cache for all the drivers.

Note: This method does the same thing as invalidate_pricing_cache and is here for backward compatibility reasons.

libcloud.pricing.download_pricing_file(file_url='https://git-wip-us.apache.org/repos/asf?p=libcloud.git;a=blob_plain;f=libcloud/data/pricing.json', file_path='/home/docs/.libcloud/pricing.json')[source]

Download pricing file from the file_url and save it to file_path.

Parameters:
  • file_url (str) – URL pointing to the pricing file.
  • file_path (str) – Path where a download pricing file will be saved.

libcloud.security module

Security (SSL) Settings

Usage:

import libcloud.security libcloud.security.VERIFY_SSL_CERT = True

# Optional. libcloud.security.CA_CERTS_PATH.append(‘/path/to/cacert.txt’)

Module contents

libcloud provides a unified interface to the cloud computing resources.

var __version__:
 Current version of libcloud
libcloud.enable_debug(fo)[source]

Enable library wide debugging to a file-like object.

Parameters:fo (File like object, only write operations are used.) – Where to append debugging information