Skip to main content

loads

Reverse of dumps(), raise BadSignature if signature fails.

The serializer is expected to accept a bytestring.

def loads(
s: string,
key: string = None,
salt: string = "django.core.signing",
serializer: class = JSONSerializer,
max_age: integer = None,
fallback_keys: list = None
) - > any

Reverse of dumps(), raise BadSignature if signature fails. The serializer is expected to accept a bytestring.

Parameters

NameTypeDescription
sstringThe signed and encoded string to be verified and deserialized
keystring = NoneThe secret key used to verify the signature; defaults to settings.SECRET_KEY
saltstring = "django.core.signing"A namespace used to ensure that signatures created for different purposes are not interchangeable
serializerclass = JSONSerializerThe class used to deserialize the unsigned string back into a Python object
max_ageinteger = NoneThe maximum allowed age of the signature in seconds; raises SignatureExpired if exceeded
fallback_keyslist = NoneA list of secondary secret keys to attempt verification against if the primary key fails

Returns

TypeDescription
anyThe original Python object that was previously signed and serialized