itsdangerous

Safely pass trusted data to untrusted environments and back.

Github星跟踪图

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

主要指标

概览
名称与所有者pallets/itsdangerous
主编程语言Python
编程语言Python (语言数: 2)
平台
许可证BSD 3-Clause "New" or "Revised" License
所有者活动
创建于2011-06-24 00:09:55
推送于2025-01-14 21:45:38
最后一次提交
发布数32
最新版本名称2.2.0 (发布于 2024-04-16 14:20:16)
第一版名称0.9 (发布于 )
用户参与
星数3k
关注者数57
派生数224
提交数659
已启用问题?
问题数119
打开的问题数1
拉请求数225
打开的拉请求数0
关闭的拉请求数58
项目设置
已启用Wiki?
已存档?
是复刻?
已锁定?
是镜像?
是私有?