Data classes

class b2sdk.v2.FileVersion(api: B2Api, id_: str, file_name: str, size: Union[int, None, str], content_type: Optional[str], content_sha1: Optional[str], file_info: Dict[str, str], upload_timestamp: int, account_id: str, bucket_id: str, action: str, content_md5: Optional[str], server_side_encryption: EncryptionSetting, file_retention: FileRetentionSetting = FileRetentionSetting(None, None), legal_hold: LegalHold = LegalHold.UNSET, replication_status: Optional[ReplicationStatus] = None)[source]

A structure which represents a version of a file (in B2 cloud).

Variables
  • ~.id_ (str) – fileId

  • ~.file_name (str) – full file name (with path)

  • ~.size – size in bytes, can be None (unknown)

  • ~.content_type (str) – RFC 822 content type, for example "application/octet-stream"

  • ~.upload_timestamp – in milliseconds since epoch. Can be None (unknown).

  • ~.action (str) – "upload", "hide" or "delete"

DEFAULT_HEADERS_LIMIT = 7000
ADVANCED_HEADERS_LIMIT = 2048
account_id
bucket_id
content_md5
action
as_dict()[source]

represents the object as a dict which looks almost exactly like the raw api output for upload/list

get_fresh_state() FileVersion[source]

Fetch all the information about this file version and return a new FileVersion object. This method does NOT change the object it is called on.

download(progress_listener: Optional[AbstractProgressListener] = None, range_: Optional[Tuple[int, int]] = None, encryption: Optional[EncryptionSetting] = None) DownloadedFile[source]
property has_large_header: bool

Determine whether FileVersion’s info fits header size limit defined by B2. This function makes sense only for “advanced” buckets, i.e. those which have Server-Side Encryption or File Lock enabled.

See https://www.backblaze.com/b2/docs/files.html#httpHeaderSizeLimit.

api
content_sha1
content_sha1_verified
content_type
delete() FileIdAndName
file_info
file_name
file_retention
id_
legal_hold
mod_time_millis
replication_status
server_side_encryption
size
update_retention(file_retention: FileRetentionSetting, bypass_governance: bool = False) BaseFileVersion
upload_timestamp
class b2sdk.v2.DownloadVersion(api: B2Api, id_: str, file_name: str, size: int, content_type: Optional[str], content_sha1: Optional[str], file_info: Dict[str, str], upload_timestamp: int, server_side_encryption: EncryptionSetting, range_: Range, content_disposition: Optional[str], content_length: int, content_language: Optional[str], expires, cache_control, content_encoding: Optional[str], file_retention: FileRetentionSetting = FileRetentionSetting(None, None), legal_hold: LegalHold = LegalHold.UNSET, replication_status: Optional[ReplicationStatus] = None)[source]

A structure which represents metadata of an initialized download

range_
content_disposition
content_length
content_language
content_encoding
api
as_dict()

represents the object as a dict which looks almost exactly like the raw api output for upload/list

content_sha1
content_sha1_verified
content_type
delete() FileIdAndName
file_info
file_name
file_retention
id_
legal_hold
mod_time_millis
replication_status
server_side_encryption
size
update_retention(file_retention: FileRetentionSetting, bypass_governance: bool = False) BaseFileVersion
upload_timestamp
class b2sdk.v2.FileIdAndName(file_id: str, file_name: str)[source]

A structure which represents a B2 cloud file with just file_name and fileId attributes.

Used to return data from calls to b2_delete_file_version and b2_cancel_large_file.

classmethod from_cancel_or_delete_response(response)[source]
as_dict()[source]

represents the object as a dict which looks almost exactly like the raw api output for delete_file_version

__dict__ = mappingproxy({'__module__': 'b2sdk.file_version', '__doc__': '\n    A structure which represents a B2 cloud file with just `file_name` and `fileId` attributes.\n\n    Used to return data from calls to b2_delete_file_version and b2_cancel_large_file.\n    ', '__init__': <function FileIdAndName.__init__>, 'from_cancel_or_delete_response': <classmethod object>, 'as_dict': <function FileIdAndName.as_dict>, '__eq__': <function FileIdAndName.__eq__>, '__repr__': <function FileIdAndName.__repr__>, '__dict__': <attribute '__dict__' of 'FileIdAndName' objects>, '__weakref__': <attribute '__weakref__' of 'FileIdAndName' objects>, '__hash__': None, '__annotations__': {}})
class b2sdk.v2.UnfinishedLargeFile[source]

A structure which represents a version of a file (in B2 cloud).

Variables
  • ~.file_id (str) – fileId

  • ~.file_name (str) – full file name (with path)

  • ~.account_id (str) – account ID

  • ~.bucket_id (str) – bucket ID

  • ~.content_type (str) – RFC 822 content type, for example "application/octet-stream"

  • ~.file_info (dict) – file info dict

class b2sdk.v2.Part(file_id, part_number, content_length, content_sha1)[source]

A structure which represents a part of a large file upload.

Variables
  • ~.file_id (str) – fileId

  • ~.part_number (int) – part number, starting with 1

  • ~.content_length (str) – content length, in bytes

  • ~.content_sha1 (str) – checksum

class b2sdk.v2.Range(start, end)[source]

HTTP ranges use an inclusive index at the end.

__init__(start, end)[source]