Skip to main content

ItsDangerous

... so better sign this

Various helpers to pass data to untrusted environments and to get it back safe and sound. Data is cryptographically signed to ensure that a token has not been tampered with.

It's possible to customize how data is serialized. Data is compressed as needed. A timestamp can be added and verified automatically while loading a token.

A Simple Example

Here's how you could generate a token for transmitting a user's id and name between web requests.

from itsdangerous import URLSafeSerializer
auth_s = URLSafeSerializer("secret key", "auth")
token = auth_s.dumps({"id": 5, "name": "itsdangerous"})

print(token)
# eyJpZCI6NSwibmFtZSI6Iml0c2Rhbmdlcm91cyJ9.6YP6T0BaO67XP--9UzTrmurXSmg

data = auth_s.loads(token)
print(data["name"])
# itsdangerous

Donate

The Pallets organization develops and supports ItsDangerous and other popular packages. In order to grow the community of contributors and users, and allow the maintainers to devote more time to the projects, please donate today.

Release files for itsdangerous 2.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for itsdangerous 2.2.0
File Size Uploaded
itsdangerous-2.2.0.tar.gz 54.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for itsdangerous 2.2.0
File Interpreter ABI Platform
itsdangerous-2.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 70.6 kB

Release files / itsdangerous-2.2.0.tar.gz

Download URL itsdangerous-2.2.0.tar.gz
Size 54.4 kB
Tags Source
SHA-256 checksum
How to use checksums
e0050c0b7da1eea53ffaf149c0cfbb5c6e2e2b69c4bef22c81fa6eb73e5f6173
BLAKE2b-256 checksum
How to use checksums
9ccb8ac0172223afbccb63986cc25049b154ecfb5e85932587206f42317be31d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/5.0.0 CPython/3.12.3

Release files / itsdangerous-2.2.0-py3-none-any.whl

Download URL itsdangerous-2.2.0-py3-none-any.whl
Size 16.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c6242fc49e35958c8b15141343aa660db5fc54d4f13a1db01a3f5891b98700ef
BLAKE2b-256 checksum
How to use checksums
049692447566d16df59b2a776c0fb82dbc4d9e07cd95062562af01e408583fc4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/5.0.0 CPython/3.12.3

Release history Release notifications | RSS feed

This release

2.2.0 This release

2 release files

2.1.2

2 release files

2.1.1

2 release files

2.1.0

2 release files

2.0.1

2 release files

2.0.0

2 release files

1.1.0

2 release files

0.24

1 release file

0.23

1 release file

0.22

1 release file

0.21

1 release file

0.20

1 release file

0.19

1 release file

0.18

1 release file

0.17

1 release file

0.16

1 release file

0.15

1 release file

0.14

1 release file

0.13

1 release file

0.12

1 release file

0.11

1 release file

0.10

1 release file

0.9.1

1 release file

0.9

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page