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.1.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.1-py2.7.egg (6.4 kB view details)

Uploaded Egg

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

Uploaded Egg

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

Uploaded Egg

File details

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

File metadata

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

File hashes

Hashes for PyJWT-0.1.1.tar.gz
Algorithm Hash digest
SHA256 d6d9369682fa846542855f7ef1e1ee9a375ad657d6981f4cc8e8ae4e8c7a0b3e
MD5 519d6c5729c34b6a78e23812f025731f
BLAKE2b-256 93e37dd205880f4cf45e8cd9b610f80c945f6af6ea0319391edd6420bbce65f6

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for PyJWT-0.1.1-py2.7.egg
Algorithm Hash digest
SHA256 1b84019335f85c321774a6d6b10e4bf42d0f5464eb9f32070eaa46b93c37930d
MD5 559ee9eda1cc1d3208e117a64775947e
BLAKE2b-256 252f9dbd46235aa182934a8776f728cff58377cc232ed0975e71a713e5ff18c9

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for PyJWT-0.1.1-py2.6.egg
Algorithm Hash digest
SHA256 d081cd19338a79c63a572535d1294a3ce28ac497815036d3981665dfabd3b9f9
MD5 320e2d6c406d0334ccd4517e0af4a21f
BLAKE2b-256 2c728505f83c2254c442faf2c6b2e093495cdb335b7a123ccd9a19df22df89b1

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for PyJWT-0.1.1-py2.5.egg
Algorithm Hash digest
SHA256 9c7cb6b363042f039c224105b88556307d7fc1f6d7939048828431ce5734c281
MD5 91473986154cc83224a3316a7341ea15
BLAKE2b-256 c87c731c4e025e7123fd8a1093d355696cc5eecfbfa5e5ba1b8a2aa30f70ffb1

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