libcloud package

Subpackages

Submodules

libcloud.base module

class libcloud.base.DriverType[source]

Bases: object

Backup-as-a-service driver

BACKUP

Compute-as-a-Service driver

alias of libcloud.backup.types.Provider

COMPUTE

Container-as-a-Service driver

alias of libcloud.compute.types.Provider

CONTAINER

DNS service provider driver

alias of libcloud.container.types.Provider

DNS

Load balancer provider-driver

alias of libcloud.dns.types.Provider

LOADBALANCER

Storage-as-a-Service driver

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]
property reason
request(method, url, body=None, headers=None, raw=False, stream=False, hooks=None)[source]
response = None
property status
timeout = None
property verification

The option for SSL verification given to underlying requests

libcloud.pricing module

A class which handles loading the pricing files.

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://libcloud-pricing-data.s3.amazonaws.com/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.pricing.get_pricing(driver_type, driver_name, pricing_file_path=None, cache_all=False)[source]

Return pricing for the provided driver.

NOTE: This method will also cache data for the requested driver memory.

We intentionally only cache data for the requested driver and not all the pricing data since the whole pricing data is quite large (~2 MB). This way we avoid unncessary memory overhead.

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.

  • cache_all (bool) – True to cache pricing data in memory for all the drivers and not just for the requested one.

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, region=None)[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.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