itsdangerous

Safely pass trusted data to untrusted environments and back.

Github stars Tracking Chart

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_:

.. code-block:: text

pip install -U itsdangerous

.. _pip: https://pip.pypa.io/en/stable/quickstart/

A Simple Example

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

.. code-block:: python

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

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_.

.. _please donate today: https://palletsprojects.com/donate

.. _BSD-3-Clause: https://github.com/pallets/itsdangerous/blob/master/LICENSE.rst

Main metrics

Overview
Name With Ownerpallets/itsdangerous
Primary LanguagePython
Program languagePython (Language Count: 2)
Platform
License:BSD 3-Clause "New" or "Revised" License
所有者活动
Created At2011-06-24 00:09:55
Pushed At2025-01-14 21:45:38
Last Commit At
Release Count32
Last Release Name2.2.0 (Posted on 2024-04-16 14:20:16)
First Release Name0.9 (Posted on )
用户参与
Stargazers Count3k
Watchers Count57
Fork Count224
Commits Count659
Has Issues Enabled
Issues Count119
Issue Open Count1
Pull Requests Count225
Pull Requests Open Count0
Pull Requests Close Count58
项目设置
Has Wiki Enabled
Is Archived
Is Fork
Is Locked
Is Mirror
Is Private