libcloud package

Subpackages

Submodules

libcloud.base module

class libcloud.base.DriverType[source]

Bases: object

Backup-as-a-service driver

BACKUP

alias of libcloud.backup.types.Provider

COMPUTE

alias of libcloud.compute.types.Provider

CONTAINER

alias of libcloud.container.types.Provider

DNS

alias of libcloud.dns.types.Provider

LOADBALANCER

alias of libcloud.loadbalancer.types.Provider

STORAGE

alias of libcloud.storage.types.Provider

exception libcloud.base.DriverTypeNotFoundError(type)[source]

Bases: KeyError

libcloud.base.get_driver(type, provider)[source]

Get a driver

libcloud.http module

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

class libcloud.http.LibcloudBaseConnection[source]

Bases: object

Base connection class to inherit from.

Note: This class should not be instantiated directly.

ca_cert = None
http_proxy_used = False
proxy_host = None
proxy_password = None
proxy_port = None
proxy_scheme = None
proxy_username = None
session = 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.http.LibcloudConnection(host, port, secure=None, **kwargs)[source]

Bases: libcloud.http.LibcloudBaseConnection

close()[source]
connect()[source]
getheaders()[source]
getresponse()[source]
host = None
prepared_request(method, url, body=None, headers=None, raw=False, stream=False)[source]
read()[source]
reason
request(method, url, body=None, headers=None, raw=False, stream=False)[source]
response = None
status
timeout = None
verification

The option for SSL verification given to underlying requests

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 = ‘/path/to/certfile’

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