Exceptions

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

Base class for all account info errors.

exception b2sdk.v1.exception.CorruptAccountInfo(file_name)[source]

Raised when an account info file is corrupted.

exception b2sdk.v1.exception.MissingAccountData(key)[source]

Raised when there is no account info data available.

exception b2sdk.v1.exception.AlreadyFailed(*args, **kwargs)[source]
exception b2sdk.v1.exception.B2ConnectionError(*args, **kwargs)[source]
exception b2sdk.v1.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.v1.exception.B2HttpCallbackException(*args, **kwargs)[source]
exception b2sdk.v1.exception.B2HttpCallbackPostRequestException(*args, **kwargs)[source]
exception b2sdk.v1.exception.B2HttpCallbackPreRequestException(*args, **kwargs)[source]
exception b2sdk.v1.exception.B2RequestTimeout(*args, **kwargs)[source]
exception b2sdk.v1.exception.B2SimpleError(*args, **kwargs)[source]

A B2Error with a message prefix.

exception b2sdk.v1.exception.BadDateFormat(*args, **kwargs)[source]
prefix = 'Date from server'
exception b2sdk.v1.exception.BadFileInfo(*args, **kwargs)[source]
exception b2sdk.v1.exception.BadJson(*args, **kwargs)[source]
prefix = 'Bad request'
exception b2sdk.v1.exception.BadUploadUrl(*args, **kwargs)[source]
exception b2sdk.v1.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.v1.exception.BucketNotAllowed(*args, **kwargs)[source]
exception b2sdk.v1.exception.CapabilityNotAllowed(*args, **kwargs)[source]
exception b2sdk.v1.exception.ChecksumMismatch(checksum_type, expected, actual)[source]
exception b2sdk.v1.exception.ClockSkew(clock_skew_seconds)[source]

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

exception b2sdk.v1.exception.CommandError(message)[source]

b2 command error (user caused). Accepts exactly one argument: message.

We expect users of shell scripts will parse our __str__ output.

exception b2sdk.v1.exception.Conflict(*args, **kwargs)[source]
exception b2sdk.v1.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.v1.exception.DestFileNewer(dest_file, source_file, 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.v1.exception.DuplicateBucketName(*args, **kwargs)[source]
prefix = 'Bucket name is already in use'
exception b2sdk.v1.exception.FileAlreadyHidden(*args, **kwargs)[source]
exception b2sdk.v1.exception.FileNameNotAllowed(*args, **kwargs)[source]
exception b2sdk.v1.exception.FileNotPresent(*args, **kwargs)[source]
exception b2sdk.v1.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.v1.exception.InvalidMetadataDirective(*args, **kwargs)[source]
exception b2sdk.v1.exception.InvalidRange(content_length, range_)[source]
exception b2sdk.v1.exception.InvalidUploadSource(*args, **kwargs)[source]
exception b2sdk.v1.exception.MaxFileSizeExceeded(size, max_allowed_size)[source]
exception b2sdk.v1.exception.MaxRetriesExceeded(limit, exception_info_list)[source]
exception b2sdk.v1.exception.MissingPart(*args, **kwargs)[source]
prefix = 'Part number has not been uploaded'
exception b2sdk.v1.exception.NonExistentBucket(*args, **kwargs)[source]
prefix = 'No such bucket'
exception b2sdk.v1.exception.NotAllowedByAppKeyError(*args, **kwargs)[source]

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

exception b2sdk.v1.exception.PartSha1Mismatch(key)[source]
exception b2sdk.v1.exception.RestrictedBucket(bucket_name)[source]
exception b2sdk.v1.exception.ServiceError(*args, **kwargs)[source]

Used for HTTP status codes 500 through 599.

exception b2sdk.v1.exception.StorageCapExceeded(*args, **kwargs)[source]
exception b2sdk.v1.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.

class b2sdk.v1.exception.TransientErrorMixin[source]
should_retry_http()[source]
should_retry_upload()[source]
exception b2sdk.v1.exception.TruncatedOutput(bytes_read, file_size)[source]
exception b2sdk.v1.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.v1.exception.UnexpectedCloudBehaviour(*args, **kwargs)[source]
exception b2sdk.v1.exception.UnknownError(*args, **kwargs)[source]
exception b2sdk.v1.exception.UnknownHost(*args, **kwargs)[source]
exception b2sdk.v1.exception.UnrecognizedBucketType(*args, **kwargs)[source]
exception b2sdk.v1.exception.UnsatisfiableRange(*args, **kwargs)[source]
exception b2sdk.v1.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.v1.exception.interpret_b2_error(status, code, message, response_headers, post_params=None)[source]
exception b2sdk.v1.exception.EnvironmentEncodingError(filename, encoding)[source]

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

exception b2sdk.v1.exception.IncompleteSync(*args, **kwargs)[source]
exception b2sdk.v1.exception.InvalidArgument(parameter_name, message)[source]

Raised when one or more arguments are invalid