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.5.tar.gz (3.7 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.5-py2.7.egg (5.7 kB view details)

Uploaded Egg

PyJWT-0.1.5-py2.6.egg (5.6 kB view details)

Uploaded Egg

PyJWT-0.1.5-py2.5.egg (5.7 kB view details)

Uploaded Egg

File details

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

File metadata

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

File hashes

Hashes for PyJWT-0.1.5.tar.gz
Algorithm Hash digest
SHA256 f42796ed343ba0403e618817733f00679ecbe729e746a80a1900e77aff6dd68d
MD5 030d1cb79eddee8cd854a0442513b341
BLAKE2b-256 7699f600544ba1487bd8dc9643085a42a74b5b0b80f93a77fef34e9bf3c8deb5

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for PyJWT-0.1.5-py2.7.egg
Algorithm Hash digest
SHA256 322723edfca260512be92b5e6fb6c3217e365039233d7a41095b58e66af8aa07
MD5 1a84b500db4cf1858c82be8dcb06add7
BLAKE2b-256 e5790d47c96d04ff0da4308bcc195d3dba06c01e66c3f0211cbb96c9593be71b

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for PyJWT-0.1.5-py2.6.egg
Algorithm Hash digest
SHA256 1247ec7c596caf3e8157cbc769bbd28f61765cb13ad38169351a010af649240b
MD5 555e40f1a2c022446848a23850d6ced9
BLAKE2b-256 88a2705c66ef78f2d461e3a70b33f92d32bb558a951b79180fee6d7dcb6fd22b

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for PyJWT-0.1.5-py2.5.egg
Algorithm Hash digest
SHA256 f12a8390f38703e844f0f81b820fe764aa381d8c6d2fb437b459d9af622be99d
MD5 c0c3436bccac647ef0763d4af5647bb2
BLAKE2b-256 5ec2885a58c9810dd80d7d6083fc2b934c387bd5e0f4651e2b569f2b21424a6f

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