Exceptions

exception b2sdk.v3.exception.AccessDenied(*args, **kwargs)[source]
exception b2sdk.v3.exception.AccountInfoError(*args, **kwargs)[source]

Base class for all account info errors.

exception b2sdk.v3.exception.AlreadyFailed(*args, **kwargs)[source]
exception b2sdk.v3.exception.B2ConnectionError(*args, **kwargs)[source]
exception b2sdk.v3.exception.B2Error(*args, **kwargs)[source]
property prefix

Nice, auto-generated error message prefix.

>>> B2SimpleError().prefix
'Simple error'
>>> AlreadyFailed().prefix
'Already failed'
should_retry_http()[source]

Return true if this is an error that can cause an HTTP call to be retried.

should_retry_upload()[source]

Return true if this is an error that should tell the upload code to get a new upload URL and try the upload again.

exception b2sdk.v3.exception.B2HttpCallbackException(*args, **kwargs)[source]
exception b2sdk.v3.exception.B2HttpCallbackPostRequestException(*args, **kwargs)[source]
exception b2sdk.v3.exception.B2HttpCallbackPreRequestException(*args, **kwargs)[source]
exception b2sdk.v3.exception.B2RequestTimeout(*args, **kwargs)[source]
exception b2sdk.v3.exception.B2RequestTimeoutDuringUpload(*args, **kwargs)[source]
should_retry_http()[source]

Return true if this is an error that can cause an HTTP call to be retried.

exception b2sdk.v3.exception.B2SimpleError(*args, **kwargs)[source]

A B2Error with a message prefix.

exception b2sdk.v3.exception.BadDateFormat(*args, **kwargs)[source]
prefix = 'Date from server'
exception b2sdk.v3.exception.BadFileInfo(*args, **kwargs)[source]
exception b2sdk.v3.exception.BadJson(*args, **kwargs)[source]
prefix = 'Bad request'
exception b2sdk.v3.exception.BadRequest(message, code)[source]
exception b2sdk.v3.exception.BadUploadUrl(*args, **kwargs)[source]
should_retry_upload()[source]

Return true if this is an error that should tell the upload code to get a new upload URL and try the upload again.

exception b2sdk.v3.exception.BrokenPipe(*args, **kwargs)[source]
should_retry_upload()[source]

Return true if this is an error that should tell the upload code to get a new upload URL and try the upload again.

exception b2sdk.v3.exception.BucketIdNotFound(bucket_id)[source]
exception b2sdk.v3.exception.BucketNotAllowed(*args, **kwargs)[source]
exception b2sdk.v3.exception.CapabilityNotAllowed(*args, **kwargs)[source]
exception b2sdk.v3.exception.CapExceeded(*args, **kwargs)[source]
exception b2sdk.v3.exception.ChecksumMismatch(checksum_type, expected, actual)[source]
exception b2sdk.v3.exception.ClockSkew(clock_skew_seconds)[source]

The clock on the server differs from the local clock by too much.

exception b2sdk.v3.exception.Conflict(*args, **kwargs)[source]
exception b2sdk.v3.exception.ConnectionReset(*args, **kwargs)[source]
should_retry_upload()[source]

Return true if this is an error that should tell the upload code to get a new upload URL and try the upload again.

exception b2sdk.v3.exception.CopyArgumentsMismatch(*args, **kwargs)[source]
exception b2sdk.v3.exception.CorruptAccountInfo(file_name)[source]

Raised when an account info file is corrupted.

exception b2sdk.v3.exception.DestFileNewer(dest_path, source_path, dest_prefix, source_prefix)[source]
should_retry_http()[source]

Return true if this is an error that can cause an HTTP call to be retried.

exception b2sdk.v3.exception.DestinationDirectoryDoesntAllowOperation(*args, **kwargs)[source]
exception b2sdk.v3.exception.DestinationDirectoryDoesntExist(*args, **kwargs)[source]
exception b2sdk.v3.exception.DestinationIsADirectory(*args, **kwargs)[source]
exception b2sdk.v3.exception.DestinationParentIsNotADirectory(*args, **kwargs)[source]
exception b2sdk.v3.exception.DisablingFileLockNotSupported(*args, **kwargs)[source]
exception b2sdk.v3.exception.DuplicateBucketName(*args, **kwargs)[source]
prefix = 'Bucket name is already in use'
exception b2sdk.v3.exception.EmailNotVerified(message, code)[source]
should_retry_upload()[source]

Return true if this is an error that should tell the upload code to get a new upload URL and try the upload again.

exception b2sdk.v3.exception.EmptyDirectory(path)[source]
exception b2sdk.v3.exception.EnvironmentEncodingError(filename, encoding)[source]

Raised when a file name can not be decoded with system encoding.

exception b2sdk.v3.exception.FileAlreadyHidden(*args, **kwargs)[source]
exception b2sdk.v3.exception.FileNameNotAllowed(*args, **kwargs)[source]
exception b2sdk.v3.exception.FileNotPresent(bucket_name=None, file_id_or_name=None)[source]
exception b2sdk.v3.exception.FileSha1Mismatch(*args, **kwargs)[source]
prefix = 'Upload file SHA1 mismatch'
exception b2sdk.v3.exception.IncompleteSync(*args, **kwargs)[source]
exception b2sdk.v3.exception.InvalidArgument(parameter_name, message)[source]

Raised when one or more arguments are invalid

exception b2sdk.v3.exception.InvalidAuthToken(message, code)[source]

Specific type of Unauthorized that means the auth token is invalid. This is not the case where the auth token is valid, but does not allow access.

exception b2sdk.v3.exception.InvalidJsonResponse(content)[source]
Parameters:

content (bytes) –

UP_TO_BYTES_COUNT = 200
exception b2sdk.v3.exception.InvalidMetadataDirective(*args, **kwargs)[source]
exception b2sdk.v3.exception.InvalidRange(content_length, range_)[source]
exception b2sdk.v3.exception.InvalidUploadSource(*args, **kwargs)[source]
exception b2sdk.v3.exception.MaxFileSizeExceeded(size, max_allowed_size)[source]
exception b2sdk.v3.exception.MaxRetriesExceeded(limit, exception_info_list)[source]
exception b2sdk.v3.exception.MissingAccountData(key)[source]

Raised when there is no account info data available.

exception b2sdk.v3.exception.MissingPart(*args, **kwargs)[source]
prefix = 'Part number has not been uploaded'
exception b2sdk.v3.exception.NonExistentBucket(bucket_name=None, file_id_or_name=None)[source]
exception b2sdk.v3.exception.NoPaymentHistory(message, code)[source]
should_retry_upload()[source]

Return true if this is an error that should tell the upload code to get a new upload URL and try the upload again.

exception b2sdk.v3.exception.NotADirectory(path)[source]
exception b2sdk.v3.exception.NotAllowedByAppKeyError(*args, **kwargs)[source]

Base class for errors caused by restrictions on an application key.

exception b2sdk.v3.exception.PartSha1Mismatch(key)[source]
exception b2sdk.v3.exception.PotentialS3EndpointPassedAsRealm(content)[source]
Parameters:

content (bytes) –

exception b2sdk.v3.exception.RestrictedBucket(bucket_names)[source]
exception b2sdk.v3.exception.RestrictedBucketMissing[source]
exception b2sdk.v3.exception.RetentionWriteError(*args, **kwargs)[source]
exception b2sdk.v3.exception.ServiceError(*args, **kwargs)[source]

Used for HTTP status codes 500 through 599.

exception b2sdk.v3.exception.SourceReplicationConflict(*args, **kwargs)[source]
exception b2sdk.v3.exception.StorageCapExceeded(*args, **kwargs)[source]
exception b2sdk.v3.exception.TooManyRequests(retry_after_seconds=None)[source]
should_retry_http()[source]

Return true if this is an error that can cause an HTTP call to be retried.

exception b2sdk.v3.exception.TransactionCapExceeded(*args, **kwargs)[source]
class b2sdk.v3.exception.TransientErrorMixin[source]
should_retry_http()[source]
should_retry_upload()[source]
exception b2sdk.v3.exception.TruncatedOutput(bytes_read, file_size)[source]
exception b2sdk.v3.exception.UnableToCreateDirectory(path)[source]
exception b2sdk.v3.exception.Unauthorized(message, code)[source]
should_retry_upload()[source]

Return true if this is an error that should tell the upload code to get a new upload URL and try the upload again.

exception b2sdk.v3.exception.UnexpectedCloudBehaviour(*args, **kwargs)[source]
exception b2sdk.v3.exception.UnknownError(*args, **kwargs)[source]
exception b2sdk.v3.exception.UnknownHost(*args, **kwargs)[source]
exception b2sdk.v3.exception.UnrecognizedBucketType(*args, **kwargs)[source]
exception b2sdk.v3.exception.UnsatisfiableRange(*args, **kwargs)[source]
exception b2sdk.v3.exception.UnsupportedFilename(message, filename)[source]

Raised when a filename is not supported by the scan operation

exception b2sdk.v3.exception.UnusableFileName(*args, **kwargs)[source]

Raise when a filename doesn’t meet the rules.

Could possibly use InvalidUploadSource, but this is intended for the filename on the server, which could differ. https://www.backblaze.com/b2/docs/files.html.

b2sdk.v3.exception.interpret_b2_error(status, code, message, response_headers, post_params=None)[source]
Parameters:
Return type:

B2Error

b2sdk.v3.exception.check_invalid_argument(parameter_name, message, *exceptions)[source]

Raise InvalidArgument in case of one of given exception was thrown.

Parameters:
Return type:

Iterator[None]

exception b2sdk.v3.exception.SSECKeyIdMismatchInCopy(*args, **kwargs)[source]
exception b2sdk.v3.exception.SSECKeyError(*args, **kwargs)[source]
exception b2sdk.v3.exception.WrongEncryptionModeForBucketDefault(encryption_mode)[source]