b2sdk.transfer.outbound.upload_source
- class b2sdk.transfer.outbound.upload_source.UploadMode(value)[source]
Bases:
Enum
Mode of file uploads
- FULL = 1
always upload the whole file
- INCREMENTAL = 2
use incremental uploads when possible
- class b2sdk.transfer.outbound.upload_source.AbstractUploadSource[source]
Bases:
OutboundTransferSource
The source of data for uploading to b2.
- class b2sdk.transfer.outbound.upload_source.UploadSourceBytes(data_bytes: Union[bytes, bytearray], content_sha1: Optional[Sha1HexDigest] = None)[source]
Bases:
AbstractUploadSource
- __init__(data_bytes: Union[bytes, bytearray], content_sha1: Optional[Sha1HexDigest] = None)[source]
Initialize upload source using given bytes.
- Parameters:
data_bytes – Data that is to be uploaded.
content_sha1 – SHA1 hexdigest of the data, or
None
.
- class b2sdk.transfer.outbound.upload_source.UploadSourceLocalFileBase(local_path: Union[PathLike, str], content_sha1: Optional[Sha1HexDigest] = None)[source]
Bases:
AbstractUploadSource
- __init__(local_path: Union[PathLike, str], content_sha1: Optional[Sha1HexDigest] = None)[source]
Initialize upload source using provided path.
- Parameters:
local_path – Any path-like object that points to a file to be uploaded.
content_sha1 – SHA1 hexdigest of the data, or
None
.
- class b2sdk.transfer.outbound.upload_source.UploadSourceLocalFileRange(local_path: Union[PathLike, str], content_sha1: Optional[Sha1HexDigest] = None, offset: int = 0, length: Optional[int] = None)[source]
Bases:
UploadSourceLocalFileBase
- __init__(local_path: Union[PathLike, str], content_sha1: Optional[Sha1HexDigest] = None, offset: int = 0, length: Optional[int] = None)[source]
Initialize upload source using provided path.
- Parameters:
local_path – Any path-like object that points to a file to be uploaded.
content_sha1 – SHA1 hexdigest of the data, or
None
.offset – Position in the file where upload should start from.
length – Amount of data to be uploaded. If
None
, length of the remainder of the file is taken.
- class b2sdk.transfer.outbound.upload_source.UploadSourceLocalFile(local_path: Union[PathLike, str], content_sha1: Optional[Sha1HexDigest] = None)[source]
Bases:
UploadSourceLocalFileBase
- get_incremental_sources(file_version: BaseFileVersion, min_part_size: Optional[int] = None) List[OutboundTransferSource] [source]
Split the upload into a copy and upload source constructing an incremental upload
This will return a list of upload sources. If the upload cannot split, the method will return [self].
- class b2sdk.transfer.outbound.upload_source.UploadSourceStream(stream_opener: Callable[[], IOBase], stream_length: Optional[int] = None, stream_sha1: Optional[Sha1HexDigest] = None)[source]
Bases:
AbstractUploadSource
- __init__(stream_opener: Callable[[], IOBase], stream_length: Optional[int] = None, stream_sha1: Optional[Sha1HexDigest] = None)[source]
Initialize upload source using arbitrary function.
- Parameters:
stream_opener – A function that opens a stream for uploading.
stream_length – Length of the stream. If
None
, data will be calculated from the stream the first time it’s required.stream_sha1 – SHA1 of the stream. If
None
, data will be calculated from the stream the first time it’s required.
- class b2sdk.transfer.outbound.upload_source.UploadSourceStreamRange(stream_opener: Callable[[], IOBase], offset: int = 0, stream_length: Optional[int] = None, stream_sha1: Optional[Sha1HexDigest] = None)[source]
Bases:
UploadSourceStream
- __init__(stream_opener: Callable[[], IOBase], offset: int = 0, stream_length: Optional[int] = None, stream_sha1: Optional[Sha1HexDigest] = None)[source]
Initialize upload source using arbitrary function.
- Parameters:
stream_opener – A function that opens a stream for uploading.
offset – Offset from which stream should be uploaded.
stream_length – Length of the stream. If
None
, data will be calculated from the stream the first time it’s required.stream_sha1 – SHA1 of the stream. If
None
, data will be calculated from the stream the first time it’s required.