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.0.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.0-py3-none-any.whl (18.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: itsdangerous-2.0.0.tar.gz
  • Upload date:
  • Size: 59.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.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.0.tar.gz
Algorithm Hash digest
SHA256 99b1053ccce68066dfc0b4465ef8779027e6d577377c8270e21a3d6289cac111
MD5 040b810d9aec891c3276f0567519ed89
BLAKE2b-256 af1ad00de29ae487412998f4a2172f0e8322dbe707d4475d981daec560b0ff58

See more details on using hashes here.

File details

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

File metadata

  • Download URL: itsdangerous-2.0.0-py3-none-any.whl
  • Upload date:
  • Size: 18.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e2cb4ae918f07ab2a2f9a91dec2695bd1f25a19d31861a70015ad537ccb5e807
MD5 0ebcd0ff2111af1ae7494cfde6042ac9
BLAKE2b-256 c4af93fb95dc8bc90a5580084f3dc4be049d243c6f687ff2e253ed3a6df30db4

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