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?
已存檔?
是復刻?
已鎖定?
是鏡像?
是私有?