b2sdk.transfer.outbound.upload_source

class b2sdk.transfer.outbound.upload_source.AbstractUploadSource[source]

Bases: b2sdk.transfer.outbound.outbound_source.OutboundTransferSource

The source of data for uploading to b2.

abstract get_content_sha1()[source]

Return a 40-character string containing the hex SHA1 checksum of the data in the file.

abstract open()[source]

Return a binary file-like object from which the data can be read. :return:

is_upload()[source]

Return if outbound source is an upload source. :rtype bool:

is_copy()[source]

Return if outbound source is a copy source. :rtype bool:

is_sha1_known()[source]
class b2sdk.transfer.outbound.upload_source.UploadSourceBytes(data_bytes, content_sha1=None)[source]

Bases: b2sdk.transfer.outbound.upload_source.AbstractUploadSource

__init__(data_bytes, content_sha1=None)[source]
get_content_length()[source]

Return the number of bytes of data in the file.

get_content_sha1()[source]

Return a 40-character string containing the hex SHA1 checksum of the data in the file.

open()[source]

Return a binary file-like object from which the data can be read. :return:

is_sha1_known()[source]
class b2sdk.transfer.outbound.upload_source.UploadSourceLocalFile(local_path, content_sha1=None)[source]

Bases: b2sdk.transfer.outbound.upload_source.AbstractUploadSource

__init__(local_path, content_sha1=None)[source]
check_path_and_get_size()[source]
get_content_length()[source]

Return the number of bytes of data in the file.

get_content_sha1()[source]

Return a 40-character string containing the hex SHA1 checksum of the data in the file.

open()[source]

Return a binary file-like object from which the data can be read. :return:

is_sha1_known()[source]
class b2sdk.transfer.outbound.upload_source.UploadSourceLocalFileRange(local_path, content_sha1=None, offset=0, length=None)[source]

Bases: b2sdk.transfer.outbound.upload_source.UploadSourceLocalFile

__init__(local_path, content_sha1=None, offset=0, length=None)[source]
open()[source]

Return a binary file-like object from which the data can be read. :return:

class b2sdk.transfer.outbound.upload_source.UploadSourceStream(stream_opener, stream_length=None, stream_sha1=None)[source]

Bases: b2sdk.transfer.outbound.upload_source.AbstractUploadSource

__init__(stream_opener, stream_length=None, stream_sha1=None)[source]
get_content_length()[source]

Return the number of bytes of data in the file.

get_content_sha1()[source]

Return a 40-character string containing the hex SHA1 checksum of the data in the file.

open()[source]

Return a binary file-like object from which the data can be read. :return:

is_sha1_known()[source]
class b2sdk.transfer.outbound.upload_source.UploadSourceStreamRange(stream_opener, offset, stream_length, stream_sha1=None)[source]

Bases: b2sdk.transfer.outbound.upload_source.UploadSourceStream

__init__(stream_opener, offset, stream_length, stream_sha1=None)[source]
open()[source]

Return a binary file-like object from which the data can be read. :return: