b2sdk.exception – Exceptions

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

Bases: b2sdk.exception.B2SimpleError

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

Bases: b2sdk.exception.TransientErrorMixin, b2sdk.exception.B2SimpleError

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

Bases: Exception

__init__(*args, **kwargs)[source]

Python 2 does not like it when you pass unicode as the message in an exception. We like to use file names in exception messages. To avoid problems, if the message has any non-ascii characters in it, they are replaced with backslash-uNNNN

https://pythonhosted.org/kitchen/unicode-frustrations.html#frustration-5-exceptions

property prefix

nice auto-generated error message prefix >>> B2SimpleError().prefix ‘Simple error’ >>> AlreadyFailed().prefix ‘Already failed’

should_retry_http()[source]

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

should_retry_upload()[source]

Returns 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.exception.B2HttpCallbackException(*args, **kwargs)[source]

Bases: b2sdk.exception.B2SimpleError

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

Bases: b2sdk.exception.B2HttpCallbackException

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

Bases: b2sdk.exception.B2HttpCallbackException

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

Bases: b2sdk.exception.TransientErrorMixin, b2sdk.exception.B2SimpleError

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

Bases: b2sdk.exception.B2Error

a B2Error with a message prefix

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

Bases: b2sdk.exception.B2SimpleError

prefix = 'Date from server'
exception b2sdk.exception.BadFileInfo(*args, **kwargs)[source]

Bases: b2sdk.exception.B2SimpleError

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

Bases: b2sdk.exception.B2SimpleError

prefix = 'Bad request'
exception b2sdk.exception.BadUploadUrl(*args, **kwargs)[source]

Bases: b2sdk.exception.TransientErrorMixin, b2sdk.exception.B2SimpleError

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

Bases: b2sdk.exception.B2Error

should_retry_upload()[source]

Returns 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.exception.BucketNotAllowed(*args, **kwargs)[source]

Bases: b2sdk.exception.NotAllowedByAppKeyError

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

Bases: b2sdk.exception.NotAllowedByAppKeyError

exception b2sdk.exception.ChecksumMismatch(checksum_type, expected, actual)[source]

Bases: b2sdk.exception.TransientErrorMixin, b2sdk.exception.B2Error

__init__(checksum_type, expected, actual)[source]

Initialize self. See help(type(self)) for accurate signature.

exception b2sdk.exception.ClockSkew(clock_skew_seconds)[source]

Bases: b2sdk.exception.B2HttpCallbackPostRequestException

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

__init__(clock_skew_seconds)[source]
Parameters

clock_skew_seconds – The different: local_clock - server_clock

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

Bases: b2sdk.exception.B2Error

b2 command error (user caused). Accepts exactly one argument. We expect users of shell scripts will parse our __str__ output.

__init__(message)[source]

Python 2 does not like it when you pass unicode as the message in an exception. We like to use file names in exception messages. To avoid problems, if the message has any non-ascii characters in it, they are replaced with backslash-uNNNN

https://pythonhosted.org/kitchen/unicode-frustrations.html#frustration-5-exceptions

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

Bases: b2sdk.exception.B2SimpleError

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

Bases: b2sdk.exception.B2Error

should_retry_upload()[source]

Returns 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.exception.DestFileNewer(dest_file, source_file, dest_prefix, source_prefix)[source]

Bases: b2sdk.exception.B2Error

__init__(dest_file, source_file, dest_prefix, source_prefix)[source]

Python 2 does not like it when you pass unicode as the message in an exception. We like to use file names in exception messages. To avoid problems, if the message has any non-ascii characters in it, they are replaced with backslash-uNNNN

https://pythonhosted.org/kitchen/unicode-frustrations.html#frustration-5-exceptions

should_retry_http()[source]

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

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

Bases: b2sdk.exception.B2SimpleError

prefix = 'Bucket name is already in use'
exception b2sdk.exception.FileAlreadyHidden(*args, **kwargs)[source]

Bases: b2sdk.exception.B2SimpleError

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

Bases: b2sdk.exception.NotAllowedByAppKeyError

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

Bases: b2sdk.exception.B2SimpleError

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

Bases: b2sdk.exception.Unauthorized

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.

__init__(message, code)[source]

Python 2 does not like it when you pass unicode as the message in an exception. We like to use file names in exception messages. To avoid problems, if the message has any non-ascii characters in it, they are replaced with backslash-uNNNN

https://pythonhosted.org/kitchen/unicode-frustrations.html#frustration-5-exceptions

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

Bases: b2sdk.exception.B2Error

exception b2sdk.exception.InvalidRange(content_length, range_)[source]

Bases: b2sdk.exception.B2Error

__init__(content_length, range_)[source]

Python 2 does not like it when you pass unicode as the message in an exception. We like to use file names in exception messages. To avoid problems, if the message has any non-ascii characters in it, they are replaced with backslash-uNNNN

https://pythonhosted.org/kitchen/unicode-frustrations.html#frustration-5-exceptions

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

Bases: b2sdk.exception.B2SimpleError

exception b2sdk.exception.MaxFileSizeExceeded(size, max_allowed_size)[source]

Bases: b2sdk.exception.B2Error

__init__(size, max_allowed_size)[source]

Python 2 does not like it when you pass unicode as the message in an exception. We like to use file names in exception messages. To avoid problems, if the message has any non-ascii characters in it, they are replaced with backslash-uNNNN

https://pythonhosted.org/kitchen/unicode-frustrations.html#frustration-5-exceptions

exception b2sdk.exception.MaxRetriesExceeded(limit, exception_info_list)[source]

Bases: b2sdk.exception.B2Error

__init__(limit, exception_info_list)[source]

Python 2 does not like it when you pass unicode as the message in an exception. We like to use file names in exception messages. To avoid problems, if the message has any non-ascii characters in it, they are replaced with backslash-uNNNN

https://pythonhosted.org/kitchen/unicode-frustrations.html#frustration-5-exceptions

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

Bases: b2sdk.exception.B2SimpleError

prefix = 'Part number has not been uploaded'
exception b2sdk.exception.NonExistentBucket(*args, **kwargs)[source]

Bases: b2sdk.exception.B2SimpleError

prefix = 'No such bucket'
exception b2sdk.exception.NotAllowedByAppKeyError(*args, **kwargs)[source]

Bases: b2sdk.exception.B2SimpleError

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

exception b2sdk.exception.PartSha1Mismatch(key)[source]

Bases: b2sdk.exception.B2Error

__init__(key)[source]

Python 2 does not like it when you pass unicode as the message in an exception. We like to use file names in exception messages. To avoid problems, if the message has any non-ascii characters in it, they are replaced with backslash-uNNNN

https://pythonhosted.org/kitchen/unicode-frustrations.html#frustration-5-exceptions

exception b2sdk.exception.RestrictedBucket(bucket_name)[source]

Bases: b2sdk.exception.B2Error

__init__(bucket_name)[source]

Python 2 does not like it when you pass unicode as the message in an exception. We like to use file names in exception messages. To avoid problems, if the message has any non-ascii characters in it, they are replaced with backslash-uNNNN

https://pythonhosted.org/kitchen/unicode-frustrations.html#frustration-5-exceptions

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

Bases: b2sdk.exception.TransientErrorMixin, b2sdk.exception.B2Error

Used for HTTP status codes 500 through 599.

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

Bases: b2sdk.exception.B2Error

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

Bases: b2sdk.exception.B2Error

should_retry_http()[source]

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

class b2sdk.exception.TransientErrorMixin[source]

Bases: object

should_retry_http()[source]
should_retry_upload()[source]
exception b2sdk.exception.TruncatedOutput(bytes_read, file_size)[source]

Bases: b2sdk.exception.TransientErrorMixin, b2sdk.exception.B2Error

__init__(bytes_read, file_size)[source]

Initialize self. See help(type(self)) for accurate signature.

exception b2sdk.exception.Unauthorized(message, code)[source]

Bases: b2sdk.exception.B2Error

__init__(message, code)[source]

Python 2 does not like it when you pass unicode as the message in an exception. We like to use file names in exception messages. To avoid problems, if the message has any non-ascii characters in it, they are replaced with backslash-uNNNN

https://pythonhosted.org/kitchen/unicode-frustrations.html#frustration-5-exceptions

should_retry_upload()[source]

Returns 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.exception.UnexpectedCloudBehaviour(*args, **kwargs)[source]

Bases: b2sdk.exception.B2SimpleError

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

Bases: b2sdk.exception.B2SimpleError

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

Bases: b2sdk.exception.B2Error

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

Bases: b2sdk.exception.B2Error

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

Bases: b2sdk.exception.B2Error

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

Bases: b2sdk.exception.B2SimpleError

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.exception.interpret_b2_error(status, code, message, post_params=None)[source]