b2sdk._internal.transfer.outbound.upload_source
- class b2sdk._internal.transfer.outbound.upload_source.UploadMode(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]
Bases:
EnumMode of file uploads
- FULL = 1
always upload the whole file
- INCREMENTAL = 2
use incremental uploads when possible
- class b2sdk._internal.transfer.outbound.upload_source.AbstractUploadSource[source]
Bases:
OutboundTransferSourceThe source of data for uploading to b2.
- abstract get_content_sha1()[source]
Returns a 40-character string containing the hex SHA1 checksum of the data in the file.
- class b2sdk._internal.transfer.outbound.upload_source.UploadSourceBytes(data_bytes, content_sha1=None)[source]
Bases:
AbstractUploadSource
- class b2sdk._internal.transfer.outbound.upload_source.UploadSourceLocalFileBase(local_path, content_sha1=None)[source]
Bases:
AbstractUploadSource
- class b2sdk._internal.transfer.outbound.upload_source.UploadSourceLocalFileRange(local_path, content_sha1=None, offset=0, length=None)[source]
Bases:
UploadSourceLocalFileBase- Parameters:
- __init__(local_path, content_sha1=None, offset=0, length=None)[source]
Initialize upload source using provided path.
- Parameters:
local_path (
PathLike|str) – Any path-like object that points to a file to be uploaded.content_sha1 (
Optional[NewType(Sha1HexDigest,str)]) – SHA1 hexdigest of the data, orNone.offset (
int) – Position in the file where upload should start from.length (
Optional[int]) – Amount of data to be uploaded. IfNone, length of the remainder of the file is taken.
- class b2sdk._internal.transfer.outbound.upload_source.UploadSourceLocalFile(local_path, content_sha1=None)[source]
Bases:
UploadSourceLocalFileBase
- class b2sdk._internal.transfer.outbound.upload_source.UploadSourceStream(stream_opener, stream_length=None, stream_sha1=None)[source]
Bases:
AbstractUploadSource- Parameters:
- __init__(stream_opener, stream_length=None, stream_sha1=None)[source]
Initialize upload source using arbitrary function.
- Parameters:
stream_opener (
Callable[[],IOBase]) – A function that opens a stream for uploading.stream_length (
Optional[int]) – Length of the stream. IfNone, data will be calculated from the stream the first time it’s required.stream_sha1 (
Optional[NewType(Sha1HexDigest,str)]) – SHA1 of the stream. IfNone, data will be calculated from the stream the first time it’s required.
- class b2sdk._internal.transfer.outbound.upload_source.UploadSourceStreamRange(stream_opener, offset=0, stream_length=None, stream_sha1=None)[source]
Bases:
UploadSourceStream- Parameters:
- __init__(stream_opener, offset=0, stream_length=None, stream_sha1=None)[source]
Initialize upload source using arbitrary function.
- Parameters:
stream_opener (
Callable[[],IOBase]) – A function that opens a stream for uploading.offset (
int) – Offset from which stream should be uploaded.stream_length (
Optional[int]) – Length of the stream. IfNone, data will be calculated from the stream the first time it’s required.stream_sha1 (
Optional[NewType(Sha1HexDigest,str)]) – SHA1 of the stream. IfNone, data will be calculated from the stream the first time it’s required.