You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
David Lord 13047062df
Merge pull request #312 from pallets/dependabot/github_actions/actions/cache-3.0.5
3 weeks ago
.github Bump actions/cache from 3.0.4 to 3.0.5 3 weeks ago
docs remove deprecated code 10 months ago
requirements update requirements 4 months ago
src/itsdangerous Merge branch '2.1.x' 5 months ago
tests/test_itsdangerous catch OSError on Windows 5 months ago
.editorconfig add EditorConfig 4 years ago
.gitignore add typing with mypy 2 years ago
.pre-commit-config.yaml update requirements 4 months ago
.readthedocs.yaml update tool config 7 months ago
CHANGES.rst Merge branch '2.1.x' 5 months ago
CONTRIBUTING.rst Improve the contributing guide 1 year ago
LICENSE.rst standardize license 3 years ago
MANIFEST.in add typing with mypy 2 years ago
README.rst Fix Issue Tracker link in README 7 months ago
setup.cfg Merge branch '2.0.x' 7 months ago
setup.py drop support for Python 2 and 3.5 2 years ago
tox.ini Merge branch '2.0.x' 7 months ago

README.rst

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.

Installing

Install and update using pip:

pip install -U itsdangerous

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.