Cloud Common

Connections

class gcloud.connection.Connection(credentials=None)[source]

Bases: object

A generic connection to Google Cloud Platform.

Subclasses should understand only the basic types in method arguments, however they should be capable of returning advanced types.

Parameters:credentials (gcloud.credentials.Credentials) – The OAuth2 Credentials to use for this connection.
API_BASE_URL = 'https://www.googleapis.com'

The base of the API call URL.

credentials[source]
http[source]

A getter for the HTTP transport used in talking to the API.

Return type:httplib2.Http
Returns:A Http object used to transport data.

Credentials

A simple wrapper around the OAuth2 credentials library.

class gcloud.credentials.Credentials[source]

Bases: object

An object used to simplify the OAuth2 credentials library.

Note

You should not need to use this class directly. Instead, use the helper methods provided in gcloud.datastore.__init__.get_connection() and gcloud.datastore.__init__.get_dataset() which use this class under the hood.

classmethod get_for_service_account(client_email, private_key_path, scope=None)[source]

Gets the credentials for a service account.

Parameters:
  • client_email (string) – The e-mail attached to the service account.
  • private_key_path (string) – The path to a private key file (this file was given to you when you created the service account).
  • scope (string or tuple of strings) – The scope against which to authenticate. (Different services require different scopes, check the documentation for which scope is required for the different levels of access to any particular API.)