jwt - JSON Web Token implementation in Python <https://pyjwt.readthedocs.io>
| Use Case | Command | Description |
|---|---|---|
| 🔑 Encode a JWT | jwt.encode(payload, key, algorithm='HS256') | Create a signed JWT token |
| 🔓 Decode a JWT | jwt.decode(token, key, algorithms=['HS256']) | Verify and decode a JWT token |
| 📄 Get unverified header | jwt.get_unverified_header(token) | Extract header without verification |
| 🔗 Fetch signing key from JWKS | PyJWKClient(uri).get_signing_key_from_jwt(token) | Retrieve key from JWK Set |
| ⚙️ Register custom algorithm | jwt.register_algorithm(alg_id, alg_obj) | Add a new algorithm for signing |
builtins.Exception
jwt.exceptions.PyJWTError
jwt.exceptions.InvalidKeyErrorjwt.exceptions.InvalidTokenError
jwt.exceptions.DecodeError
jwt.exceptions.InvalidSignatureErrorjwt.exceptions.ExpiredSignatureErrorjwt.exceptions.ImmatureSignatureErrorjwt.exceptions.InvalidAlgorithmErrorjwt.exceptions.InvalidAudienceErrorjwt.exceptions.InvalidIssuedAtErrorjwt.exceptions.InvalidIssuerErrorjwt.exceptions.MissingRequiredClaimErrorjwt.exceptions.PyJWKClientErrorjwt.exceptions.PyJWKErrorjwt.exceptions.PyJWKSetErrorAll exception classes inherit from PyJWTError and share the standard methods from builtins.Exception and builtins.BaseException (e.g., __init__, __str__, with_traceback). Only unique or overridden members are listed below.
PyJWTErrorBase class for all exceptions
__weakref__ — list of weak references to the object (if defined)InvalidKeyErrorInherits from PyJWTError
InvalidTokenErrorInherits from PyJWTError
DecodeErrorInherits from InvalidTokenError
InvalidSignatureErrorInherits from DecodeError
ExpiredSignatureErrorInherits from InvalidTokenError
ImmatureSignatureErrorInherits from InvalidTokenError
InvalidAlgorithmErrorInherits from InvalidTokenError
InvalidAudienceErrorInherits from InvalidTokenError
InvalidIssuedAtErrorInherits from InvalidTokenError
InvalidIssuerErrorInherits from InvalidTokenError
MissingRequiredClaimErrorInherits from InvalidTokenError
__init__(self, claim) — Initialize self__str__(self) — Return str(self)PyJWKClientErrorInherits from PyJWTError
PyJWKErrorInherits from PyJWTError
PyJWKSetErrorInherits from PyJWTError
PyJWKPyJWK(jwk_data, algorithm=None)
__init__(self, jwk_data, algorithm=None)from_dict(obj, algorithm=None) — static methodfrom_json(data, algorithm=None) — static methodkey_id — readonly propertykey_type — readonly propertypublic_key_use — readonly property__dict__, __weakref__PyJWKClientPyJWKClient(uri: str, cache_keys: bool = True, max_cached_keys: int = 16)
__init__(self, uri, cache_keys=True, max_cached_keys=16)fetch_data(self) -> Anyget_jwk_set(self) -> jwt.api_jwk.PyJWKSetget_signing_key(self, kid: str) -> jwt.api_jwk.PyJWKget_signing_key_from_jwt(self, token: str) -> jwt.api_jwk.PyJWKget_signing_keys(self) -> List[jwt.api_jwk.PyJWK]__dict__, __weakref__PyJWKSetPyJWKSet(keys)
__init__(self, keys)from_dict(obj) — static methodfrom_json(data) — static method__dict__, __weakref__PyJWSPyJWS(algorithms=None, options=None)
header_typ = 'JWT'__init__(self, algorithms=None, options=None)decode(self, jwt, key='', algorithms=None, options=None, **kwargs) -> strdecode_complete(self, jwt, key='', algorithms=None, options=None, **kwargs) -> Dict[str, Any]encode(self, payload, key, algorithm='HS256', headers=None, json_encoder=None) -> strget_algorithms(self) — Returns a list of supported values for the 'alg' parameter.get_unverified_header(self, jwt) — Returns the JWT header parameters as a dict() (signature not verified)register_algorithm(self, alg_id, alg_obj) — Registers a new Algorithmunregister_algorithm(self, alg_id) — Unregisters an Algorithm (throws KeyError)__dict__, __weakref__PyJWTPyJWT(options=None)
__init__(self, options=None)decode(self, jwt, key='', algorithms=None, options=None, **kwargs) -> Dict[str, Any]decode_complete(self, jwt, key='', algorithms=None, options=None, **kwargs) -> Dict[str, Any]encode(self, payload, key, algorithm='HS256', headers=None, json_encoder=None) -> str__dict__, __weakref__decode(jwt, key='', algorithms=None, options=None, **kwargs) -> Dict[str, Any] — method of jwt.api_jwt.PyJWT instanceencode(payload, key, algorithm='HS256', headers=None, json_encoder=None) -> str — method of jwt.api_jwt.PyJWT instanceget_unverified_header(jwt) — method of jwt.api_jws.PyJWS instance. Returns the JWT header parameters as a dict() (signature not verified)register_algorithm(alg_id, alg_obj) — method of jwt.api_jws.PyJWS instance. Registers a new Algorithmunregister_algorithm(alg_id) — method of jwt.api_jws.PyJWS instance. Unregisters an Algorithm (throws KeyError)__all__ = ['PyJWS', 'PyJWT', 'PyJWKClient', 'PyJWK', 'PyJWKSet', 'deco...']__copyright__ = 'Copyright 2015-2020 José Padilla'__description__ = 'JSON Web Token implementation in Python'__email__ = 'hello AT jpadilla.com'__license__ = 'MIT'__title__ = 'PyJWT'__uri__ = 'https://pyjwt.readthedocs.io'__url__ = 'https://pyjwt.readthedocs.io'2.3.0
José Padilla
/usr/lib/python3/dist-packages/jwt/__init__.py
Generated by phpman v4.10.0-7-g98e9fd5 · Markdown · JSON · MCP Author: Che Dong Under GNU General Public License
2026-09-01 18:51 @216.73.216.239
CrawledBy Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)