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
Metadata
Release files for PyJWT 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| PyJWT-0.1.1.tar.gz | 3.2 kB | Details |
Built distributions (wheels)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| PyJWT-0.1.1-py2.7.egg | Legacy Egg format | - | - | Details |
| PyJWT-0.1.1-py2.6.egg | Legacy Egg format | - | - | Details |
| PyJWT-0.1.1-py2.5.egg | Legacy Egg format | - | - | Details |
Total release size: 22.3 kB
Release files / PyJWT-0.1.1.tar.gz
| Download URL | PyJWT-0.1.1.tar.gz |
|---|---|
| Size | 3.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d6d9369682fa846542855f7ef1e1ee9a375ad657d6981f4cc8e8ae4e8c7a0b3e
|
|
BLAKE2b-256 checksum How to use checksums |
93e37dd205880f4cf45e8cd9b610f80c945f6af6ea0319391edd6420bbce65f6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / PyJWT-0.1.1-py2.7.egg
| Download URL | PyJWT-0.1.1-py2.7.egg |
|---|---|
| Size | 6.4 kB |
| Tags | Egg |
|
SHA-256 checksum How to use checksums |
1b84019335f85c321774a6d6b10e4bf42d0f5464eb9f32070eaa46b93c37930d
|
|
BLAKE2b-256 checksum How to use checksums |
252f9dbd46235aa182934a8776f728cff58377cc232ed0975e71a713e5ff18c9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / PyJWT-0.1.1-py2.6.egg
| Download URL | PyJWT-0.1.1-py2.6.egg |
|---|---|
| Size | 6.3 kB |
| Tags | Egg |
|
SHA-256 checksum How to use checksums |
d081cd19338a79c63a572535d1294a3ce28ac497815036d3981665dfabd3b9f9
|
|
BLAKE2b-256 checksum How to use checksums |
2c728505f83c2254c442faf2c6b2e093495cdb335b7a123ccd9a19df22df89b1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / PyJWT-0.1.1-py2.5.egg
| Download URL | PyJWT-0.1.1-py2.5.egg |
|---|---|
| Size | 6.3 kB |
| Tags | Egg |
|
SHA-256 checksum How to use checksums |
9c7cb6b363042f039c224105b88556307d7fc1f6d7939048828431ce5734c281
|
|
BLAKE2b-256 checksum How to use checksums |
c87c731c4e025e7123fd8a1093d355696cc5eecfbfa5e5ba1b8a2aa30f70ffb1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |