Skip to main content

JSON Web Token implemtnation in Python

Project description

A Python implementation of [JSON Web Token draft 01](http://self-issued.info/docs/draft-jones-json-web-token-01.html).

Installing

sudo easy_install PyJWT

Usage

import jwt jwt.encode({“some”: “payload”}, “secret”)

Note the resulting JWT will not be encrypted, but verifiable with a secret key.

jwt.decode(“someJWTstring”, “secret”)

If the secret is wrong, it will raise a jwt.DecodeError telling you as such. You can still get at the payload by setting the verify argument to false.

jwt.decode(“someJWTstring”, verify=False)

Algorithms

The JWT spec supports several algorithms for cryptographic signing. This library currently supports:

  • HS256 - HMAC using SHA-256 hash algorithm (default)

  • HS384 - HMAC using SHA-384 hash algorithm

  • HS512 - HMAC using SHA-512 hash algorithm

Change the algorithm with by setting it in encode:

jwt.encode({“some”: “payload”}, “secret”, “HS512”)

Tests

You can run tests from the project root after installed with:

python tests/test_jwt.py

License

MIT

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

PyJWT-0.1.2.tar.gz (3.2 kB view details)

Uploaded Source

Built Distributions

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

PyJWT-0.1.2-py2.7.egg (6.3 kB view details)

Uploaded Egg

PyJWT-0.1.2-py2.6.egg (6.3 kB view details)

Uploaded Egg

PyJWT-0.1.2-py2.5.egg (6.3 kB view details)

Uploaded Egg

File details

Details for the file PyJWT-0.1.2.tar.gz.

File metadata

  • Download URL: PyJWT-0.1.2.tar.gz
  • Upload date:
  • Size: 3.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for PyJWT-0.1.2.tar.gz
Algorithm Hash digest
SHA256 4bf95198d08f91adf59185f3f37228c974394d7bbd1dbbba620a17428d75387d
MD5 523cf273edf1fe29885c08b98b5c8d53
BLAKE2b-256 ee7ad693d3c40385d30a595a011151085abbfccaf38cbefa6f86143273d27fb1

See more details on using hashes here.

File details

Details for the file PyJWT-0.1.2-py2.7.egg.

File metadata

  • Download URL: PyJWT-0.1.2-py2.7.egg
  • Upload date:
  • Size: 6.3 kB
  • Tags: Egg
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for PyJWT-0.1.2-py2.7.egg
Algorithm Hash digest
SHA256 2f8735e5ef24b4ebe20666b7eff302b0736f257e91b267c3ab0a02c7da5899e8
MD5 4e0422517a5b88ec57a0be2cdeb5fa7d
BLAKE2b-256 cb15513a1b21515741cd6dd5893f54249588c2bb60a8f58891b090a1a511f75a

See more details on using hashes here.

File details

Details for the file PyJWT-0.1.2-py2.6.egg.

File metadata

  • Download URL: PyJWT-0.1.2-py2.6.egg
  • Upload date:
  • Size: 6.3 kB
  • Tags: Egg
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for PyJWT-0.1.2-py2.6.egg
Algorithm Hash digest
SHA256 8aaa1bc305fa00e7d6e977ce3171f94dcf87c958734adfd30690d4d0cadaf44e
MD5 6d08f6964d4fc5edd1457b207131997a
BLAKE2b-256 3e2960e88a96eb0c2d73ee4e8901b5b9c8c27cf30c0077acd6f077aa6511d9a3

See more details on using hashes here.

File details

Details for the file PyJWT-0.1.2-py2.5.egg.

File metadata

  • Download URL: PyJWT-0.1.2-py2.5.egg
  • Upload date:
  • Size: 6.3 kB
  • Tags: Egg
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for PyJWT-0.1.2-py2.5.egg
Algorithm Hash digest
SHA256 6d9bfc8f2226c42e44da0513a9164c536ae652210d005cd308891f900a5d272c
MD5 4dc48c3dae693cb10946234f5ab01169
BLAKE2b-256 d7e31c7bea3963f34d282c7a2bd1b8b0b11393f8bbd5e80a55501dc7f639433d

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