duplicity.backends.b2backend module

class duplicity.backends.b2backend.B2Backend(parsed_url)[source]

Bases: duplicity.backend.Backend

Backend for BackBlaze’s B2 storage service

create_bucket(bucket_name)[source]

Create a bucket with name bucket_name and save its id

find_or_create_bucket(bucket_name)[source]

Find a bucket with name bucket_name and save its id. If it doesn’t exist, create it

formatted_url(endpoint)[source]

Return the full api endpoint from just the last part

full_filename(filename)[source]
get_file_id(filename)[source]

Get a file id form filename

get_file_info(filename)[source]

Get a file info from filename

get_or_post(url, data, headers=None, data_file=None)[source]

Sends the request, either get or post. If data and data_file are None, send a get request. data_file takes precedence over data. If headers are not supplied, just send with an auth key

get_upload_info(bucket_id)[source]

Get an upload url for a bucket

static hex_sha1_of_file(path)[source]

Calculate the sha1 of a file to upload

class duplicity.backends.b2backend.OpenUrl(url, data, headers)[source]

Bases: object

Context manager that handles an open urllib2.Request, and provides the file-like object that is the response.