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: 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

property duration
property path
pause()[source]

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

property 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.

property start_time
property 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: 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: 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: 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

property duration
property file_name
partition_file(fp)[source]
pause()[source]

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

property 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.

property start_time
property 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

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

Bases: object

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