The sugarsync_store Module

Created on 08.04.2011

class cloudfusion.store.sugarsync.sugarsync_store.HTTP_STATUS

Bases: object

AUTHORIZATION_REQUIRED = 401
BAD_REQUEST = 400
CREATED = 201
FORBIDDEN = 403
INCORRECT_RANGE = 416
MOVED_PERMANENTLY = 301
NOT_ACCEPTABLE = 406
NOT_FOUND = 404
OK = [200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299]
OVER_STORAGE_LIMIT = 413
SERVER_ERROR = [500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, 512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531, 532, 533, 534, 535, 536, 537, 538, 539, 540, 541, 542, 543, 544, 545, 546, 547, 548, 549, 550, 551, 552, 553, 554, 555, 556, 557, 558, 559, 560, 561, 562, 563, 564, 565, 566, 567, 568, 569, 570, 571, 572, 573, 574, 575, 576, 577, 578, 579, 580, 581, 582, 583, 584, 585, 586, 587, 588, 589, 590, 591, 592, 593, 594, 595, 596, 597, 598, 599]
static generate_exception(code, msg, method_name='')
static get_status_desc(code)
static log_error(logger, code, method_name, msg)
class cloudfusion.store.sugarsync.sugarsync_store.SugarsyncStore(config)

Bases: cloudfusion.store.store.Store

config can be obtained from the function cloudfusion.store.sugarsync.sugarsync_store.SugarsyncStore.get_config(), but you need to add user and password:

config = SugarsyncStore.get_config()
config['user'] = 'me@emailserver.com' #your account username/e-mail address
config['password'] = 'MySecret!23$' #your account password

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

path_to_my_config_file = '/home/joe/MySugarsync.ini'       
config = get_config(path_to_my_config_file)
Parameters:config – dictionary with key value pairs
_SugarsyncStore__get_dir_listing(directory)
Returns:The cached directory listing of directory,

retrieving the listing if it does not yet exist.

_SugarsyncStore__insert_dir_listing(path)

Insert path into the cached directory listing, keeping the order sorted, retrieving the listing if it does not yet exist.

_SugarsyncStore__is_in_dir_listing(path)
Returns:True iff. path is in the cache of directory listings.
_SugarsyncStore__is_in_partial_dir_listing(path, cached_listing)

Check if path exists on the remote server. Tries to do only a partial listing to find out if path exists remotely, also caches this listing for three seconds. :param cached_listing: a locally cached listing used to determine the position of path in the remote listing :returns: True if path exists in the actual listing or in a partial listing that is cached for 3 seconds, False if it is not in the actual listing, or None if the existence is uncertain

_SugarsyncStore__remove_from_dir_listing(path)

Remove path from the cached directory listing.

_SugarsyncStore__set_dir_listing(directory, listing)

Set the directory listing of directory.

_cache(directory, collection)
_create_file(path, mime='text/x-cloudfusion')
_extract_files(xml_tree)
_extract_folders(xml_tree)
_get_time_difference(*args, **kwargs)
_handle_error(error, stacktrace, method_name, remaining_tries, *args, **kwargs)
_is_end_of_collection(xml_tree)
Returns:True iff. the partial directory listing in xml_tree contains the last file system item.
_parse_collection(translated_path)
Returns:dict a dictionary with all paths of the collection at translated_path as keys and the corresponding nested dictionaries with the key/value pair for is_dir and reference.
_parse_directory(path, resp)
_parse_file(path, resp)
_translate_path(path)

Translate unix style path into Sugarsync style path. :raise NoSuchFilesytemObjectError: if there is no such path

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

Get initial sugarsync configuration to initialize cloudfusion.store.sugarsync.sugarsync_store.SugarsyncStore :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(*args, **kwargs)
get_used_space(*args, **kwargs)
reconnect()
store_fileobject(*args, **kwargs)

The client Module

Created on 04.05.2011

class cloudfusion.store.sugarsync.client.HTTPResponse(response, data)

Bases: object

classmethod get_instance(status, reason, headers, data)
getheader(name, default=None)
getheaders()
class cloudfusion.store.sugarsync.client.NoAuth

Bases: requests.auth.AuthBase

Do nothing authentication handler, to prevent requests from using credentials stored in the .netrc configuration file.

class cloudfusion.store.sugarsync.client.SugarsyncClient(config)

Bases: object

_reconnect()
create_file(directory, name, mime='text/x-cloudfusion')
create_folder(directory, name)
create_token()
create_user(username, password)
delete_file(path)
delete_folder(path)
duplicate_file(path_to_src, path_to_dest, name)
get_dir_listing(path, index=0, max=1000000)
get_file(path_to_file)
get_file_metadata(path_to_file)
get_folder_metadata(path)
get_syncfolders()
put_file(fileobject, path_to_file)
put_file_async(path_to_src, path_to_dest, response_queue)
user_info()

Table Of Contents

Previous topic

The google_drive Module

Next topic

The local_hd_store Module

This Page