Data classes

class b2sdk.v1.FileVersionInfo(id_, file_name, size, content_type, content_sha1, file_info, upload_timestamp, action, content_md5=None, server_side_encryption: Optional[b2sdk.encryption.setting.EncryptionSetting] = 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 (int or None) – size in bytes, can be None (unknown)

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

  • content_sha1 (str or None) – sha1 checksum of the entire file, can be None (unknown) if it is a large file uploaded by a client which did not provide it

  • content_md5 (str or None) – md5 checksum of the file, can be None (unknown)

  • file_info (dict) – file info dict

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

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

LS_ENTRY_TEMPLATE = '%83s  %6s  %10s  %8s  %9d  %s'
as_dict()[source]

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

format_ls_entry()[source]

legacy method, to be removed in v2: formats a ls entry for b2 command line tool

classmethod format_folder_ls_entry(name)[source]

legacy method, to be removed in v2: formats a ls “folder” consistently with format_ls_entry()

__dict__ = mappingproxy({'__module__': 'b2sdk.file_version', '__doc__': '\n    A structure which represents a version of a file (in B2 cloud).\n\n    :ivar str ~.id\\_: ``fileId``\n    :ivar str ~.file_name: full file name (with path)\n    :ivar ~.size: size in bytes, can be ``None`` (unknown)\n    :vartype ~.size: int or None\n    :ivar str ~.content_type: RFC 822 content type, for example ``"application/octet-stream"``\n    :ivar ~.content_sha1: sha1 checksum of the entire file, can be ``None`` (unknown) if it is a large file uploaded by a client which did not provide it\n    :vartype ~.content_sha1: str or None\n    :ivar ~.content_md5: md5 checksum of the file, can be ``None`` (unknown)\n    :vartype ~.content_md5: str or None\n    :ivar dict ~.file_info: file info dict\n    :ivar ~.upload_timestamp: in milliseconds since :abbr:`epoch (1970-01-01 00:00:00)`. Can be ``None`` (unknown).\n    :vartype ~.upload_timestamp: int or None\n    :ivar str ~.action: ``"upload"``, ``"hide"`` or ``"delete"``\n    ', 'LS_ENTRY_TEMPLATE': '%83s  %6s  %10s  %8s  %9d  %s', '__init__': <function FileVersionInfo.__init__>, 'as_dict': <function FileVersionInfo.as_dict>, 'format_ls_entry': <function FileVersionInfo.format_ls_entry>, 'format_folder_ls_entry': <classmethod object>, '__dict__': <attribute '__dict__' of 'FileVersionInfo' objects>, '__weakref__': <attribute '__weakref__' of 'FileVersionInfo' objects>, '__annotations__': {}})
class b2sdk.v1.FileIdAndName(file_id, file_name)[source]

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

Used to return data from calls to b2sdk.v1.Bucket.delete_file_version().

Variables
  • file_id (str) – fileId

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

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 :py:meth:`b2sdk.v1.Bucket.delete_file_version`.\n\n    :ivar str ~.file_id: ``fileId``\n    :ivar str ~.file_name: full file name (with path)\n    ', '__init__': <function FileIdAndName.__init__>, 'as_dict': <function FileIdAndName.as_dict>, '__dict__': <attribute '__dict__' of 'FileIdAndName' objects>, '__weakref__': <attribute '__weakref__' of 'FileIdAndName' objects>, '__annotations__': {}})
class b2sdk.v1.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.v1.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