Skip to main content

Safely pass data to untrusted environments and back.

Project description

… 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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

itsdangerous-2.0.0rc2.tar.gz (59.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

itsdangerous-2.0.0rc2-py3-none-any.whl (18.3 kB view details)

Uploaded Python 3

File details

Details for the file itsdangerous-2.0.0rc2.tar.gz.

File metadata

  • Download URL: itsdangerous-2.0.0rc2.tar.gz
  • Upload date:
  • Size: 59.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.10.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.1

File hashes

Hashes for itsdangerous-2.0.0rc2.tar.gz
Algorithm Hash digest
SHA256 aea4b5c1c81179e92d04142ed2dc6a44642da3909fdb5c7b64e7ea946d4b3bd6
MD5 8e62ce579f73c92b0f44c892d58ccb00
BLAKE2b-256 91df5fb8d82f4a9078c37d76f6bd026dd23654294f36aa67921f45d34f0cd128

See more details on using hashes here.

File details

Details for the file itsdangerous-2.0.0rc2-py3-none-any.whl.

File metadata

  • Download URL: itsdangerous-2.0.0rc2-py3-none-any.whl
  • Upload date:
  • Size: 18.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.10.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.1

File hashes

Hashes for itsdangerous-2.0.0rc2-py3-none-any.whl
Algorithm Hash digest
SHA256 fe99186c3f66ab0a064c51bedb72772c95b7f919e0ac9feed37f7c4be2745b15
MD5 94f791bd643597bb6af003d5f65e4dd6
BLAKE2b-256 f188188ad8b416a7890ae36c1df7bab3b98aae1a9a9ea6b48ceaf5553bfc30cd

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page