Debian Codegraph @

README.md

raw
1 # ItsDangerous
2
3 ... so better sign this
4
5 Various helpers to pass data to untrusted environments and to get it
6 back safe and sound. Data is cryptographically signed to ensure that a
7 token has not been tampered with.
8
9 It's possible to customize how data is serialized. Data is compressed as
10 needed. A timestamp can be added and verified automatically while
11 loading a token.
12
13
14 ## A Simple Example
15
16 Here's how you could generate a token for transmitting a user's id and
17 name between web requests.
18
19 ```python
20 from itsdangerous import URLSafeSerializer
21 auth_s = URLSafeSerializer("secret key", "auth")
22 token = auth_s.dumps({"id": 5, "name": "itsdangerous"})
23
24 print(token)
25 # eyJpZCI6NSwibmFtZSI6Iml0c2Rhbmdlcm91cyJ9.6YP6T0BaO67XP--9UzTrmurXSmg
26
27 data = auth_s.loads(token)
28 print(data["name"])
29 # itsdangerous
30 ```
31
32
33 ## Donate
34
35 The Pallets organization develops and supports ItsDangerous and other
36 popular packages. In order to grow the community of contributors and
37 users, and allow the maintainers to devote more time to the projects,
38 [please donate today][].
39
40 [please donate today]: https://palletsprojects.com/donate