sevenbridges.transfer package

Submodules

sevenbridges.transfer.download module

class sevenbridges.transfer.download.DPartedFile(file_path, session, url, file_size, part_size, timeout, pool)[source]

Bases: object

done()[source]
get_parts()[source]

Partitions the file and saves the part information in memory.

submit()[source]

Partitions the file into chunks and submits them into group of 4 for download on the api download pool.

class sevenbridges.transfer.download.Download(url, file_path, part_size=None, retry_count=None, timeout=None, api=None)[source]

Bases: threading.Thread

add_callback(callback=None, errorback=None)[source]

Adds a callback that will be called when the download finishes successfully or when error is raised.

add_progress_callback(callback=None)[source]

Adds a progress callback that will be called each time a get_parts is successfully downloaded. The first argument of the progress callback will be a progress object described in sevenbridges.transfer.utils

Parameters:callback – Callback function
duration
path
pause()[source]

Pauses the download. :raises SbgError: If upload is not in RUNNING state.

progress
resume()[source]

Resumes the download. :raises SbgError: If download is not in RUNNING state.

run()[source]

Runs the thread! Should not be used use start() method instead.

start()[source]

Starts the download. :raises SbgError: If download is not in PREPARING state.

start_time
status
stop()[source]

Stops the download. :raises SbgError: If download is not in PAUSED or RUNNING state.

wait()[source]

Blocks until download is completed.

sevenbridges.transfer.upload module

class sevenbridges.transfer.upload.CodePackageUPartedFile(fp, file_size, part_size, upload, timeout, storage_session, api)[source]

Bases: sevenbridges.transfer.upload.UPartedFile

class sevenbridges.transfer.upload.CodePackageUpload(file_path, automation_id, file_name=None, part_size=None, retry_count=6, timeout=300, parent=None, api=None)[source]

Bases: sevenbridges.transfer.upload.Upload

partition_file(fp)[source]
class sevenbridges.transfer.upload.UPartedFile(fp, file_size, part_size, upload, timeout, storage_session, api)[source]

Bases: object

done()[source]
get_parts()[source]

Partitions the file and saves the parts to be uploaded in memory.

submit()[source]

Partitions the file into chunks and submits them into group of 4 for upload on the api upload pool. :return: Futures

class sevenbridges.transfer.upload.Upload(file_path, project=None, parent=None, file_name=None, overwrite=False, part_size=None, retry_count=None, timeout=None, api=None)[source]

Bases: threading.Thread

add_callback(callback=None, errorback=None)[source]

Adds a callback that will be called when the upload finishes successfully or when error is raised.

add_progress_callback(callback=None)[source]

Adds a progress callback that will be called each time a get_parts is successfully uploaded. The first argument of the progress callback will be a progress object described in sevenbridges.transfer.utils

Parameters:callback – Callback function
duration
file_name
partition_file(fp)[source]
pause()[source]

Pauses the upload. :raises SbgError: If upload is not in RUNNING state.

progress
result()[source]
resume()[source]

Resumes the upload that was paused. :raises SbgError: If upload is not in PAUSED state.

run()[source]

Runs the thread! Should not be used use start() method instead.

start()[source]

Starts the upload. :raises SbgError: If upload is not in PREPARING state.

start_time
status
stop()[source]

Stops the upload. :raises SbgError: If upload is not in PAUSED or RUNNING state.

wait()[source]

Blocks until upload is completed.

sevenbridges.transfer.utils module

class sevenbridges.transfer.utils.Part(start=None, size=None)[source]

Bases: object

size
start
class sevenbridges.transfer.utils.Progress(num_of_parts, parts_done, bytes_done, file_size, duration)[source]

Bases: object

bandwidth
bytes_done
duration
file_size
num_of_parts
parts_done
progress
sevenbridges.transfer.utils.simple_progress_bar(progress)[source]
sevenbridges.transfer.utils.total_parts(file_size, part_size)[source]