Exceptions¶
- exception itsdangerous.exc.BadData(message)¶
Raised if bad data of any sort was encountered. This is the base for all exceptions that ItsDangerous defines.
Changelog
Added in version 0.15.
- Parameters:
message (str)
- exception itsdangerous.exc.BadSignature(message, payload=None)¶
Raised if a signature does not match.
- Parameters:
message (str)
payload (t.Any | None)
- exception itsdangerous.exc.BadTimeSignature(message, payload=None, date_signed=None)¶
Raised if a time-based signature is invalid. This is a subclass of
BadSignature
.- date_signed¶
If the signature expired this exposes the date of when the signature was created. This can be helpful in order to tell the user how long a link has been gone stale.
Changelog
Changed in version 2.0: The datetime value is timezone-aware rather than naive.
Added in version 0.14.
- exception itsdangerous.exc.SignatureExpired(message, payload=None, date_signed=None)¶
Raised if a signature timestamp is older than
max_age
. This is a subclass ofBadTimeSignature
.
- exception itsdangerous.exc.BadHeader(message, payload=None, header=None, original_error=None)¶
Raised if a signed header is invalid in some form. This only happens for serializers that have a header that goes with the signature.
Changelog
Added in version 0.24.
- Parameters:
- exception itsdangerous.exc.BadPayload(message, original_error=None)¶
Raised if a payload is invalid. This could happen if the payload is loaded despite an invalid signature, or if there is a mismatch between the serializer and deserializer. The original exception that occurred during loading is stored on as
original_error
.Changelog
Added in version 0.15.