The google_drive Module

Created on 08.04.2011

@author: joe

class cloudfusion.store.gdrive.google_drive.GoogleDrive(config)

Bases: cloudfusion.store.store.Store

Subclass of Store implementing an interface to the Google Drive.

config can be obtained from the function cloudfusion.store.gdrive.google_drive.GoogleDrive.get_config(), but you need to add the id and secret, which can be obtained by creating an id and secret for an “Installed Application” in the developer console: https://console.developers.google.com/project, as described in https://developers.google.com/drive/web/quickstart/quickstart-python:

config = GoogleDrive.get_config()
config['id'] = '4523154788555-kjsdfj87sdfjh44dfsdfj45kjj.apps.googleusercontent.com' #your id            
config['secret'] = 'sdfjk3h5j444jnjfo0' #your secret

You may add a cache id, so that you can continue previous sessions. If you use the same cache id in a later session, the store will remember some metadata and won’t need the id and secret for authentication (just use empty strings in this case):

config['cache_id'] = 'gdrive_db'

Or you can use a configuration file that already has id and secret set by specifying a path:

path_to_my_config_file = '/home/joe/gdrive.ini'       
config = GoogleDrive.get_config(path_to_my_config_file)
Parameters:config – dictionary with key value pairs
CLIENT_AUTH_TEMPLATE = <string.Template object at 0x6a8c690>
SETTINGS_YAML_TEMPLATE = <string.Template object at 0x6a8c6d0>
_GoogleDrive__get_size(fileobject)
_copy_drive()

Create a deep copy of the GoogleAuth object, and the GoogleDrive object for use by another thread. :returns: a tuple with the copies of the GoogleAuth and the GoogelDrive object

_get_cachedir_name(config)
_get_credentials_db_path(config)
_get_fileobject_id(path)
_get_time_difference()
_handle_error(error, stacktrace, method_name, remaining_tries, *args, **kwargs)

Used by retry decorator to react to errors.

account_info(*args, **kwargs)
create_directory(*args, **kwargs)
delete(*args, **kwargs)
duplicate(path_to_src, path_to_dest)
exists(path)
static get_config(path_to_configfile=None)

Get initial google drive configuration to initialize cloudfusion.store.gdrive.google_drive.GoogleDrive :param path_to_configfile: path to a configuration file or None, which will use the default configuration file

get_directory_listing(*args, **kwargs)
get_file(*args, **kwargs)
get_logging_handler()
get_max_filesize()

Return maximum number of bytes per file

get_metadata(*args, **kwargs)
get_name()
get_overall_space()
get_used_space()
store_fileobject(*args, **kwargs)

Previous topic

The bulk_get_metadata_google_store Module

Next topic

The sugarsync_store Module

This Page