pyjwt API Reference
Full documentation for pyjwt (2.13.0)
pyjwt.DecodeError
Python Library Documentation: class DecodeError in module jwt.exceptions class DecodeError(InvalidTokenError) | Raised when a token cannot be decoded because it failed validation | | Method resolution order: | DecodeError | InvalidTokenError | PyJWTError | builtins.Exception | builtins.BaseException | builtins.object | | Data descriptors inherited from PyJWTError: | | __weakref__ | list of weak references to the object | | ---------------------------------------------------------------------- | Methods inherited from builtins.Exception: | | __init__(self, /, *args, **kwargs) | Initialize self. See help(type(self)) for accurate signature. | | ---------------------------------------------------------------------- | Static methods inherited from builtins.Exception: | | __new__(*args, **kwargs) class method of builtins.Exception | Create and return a new object. See help(type) for accurate signature. | | ---------------------------------------------------------------------- | Methods inherited from builtins.BaseException: | | __getattribute__(self, name, /) | Return getattr(self, name). | | __reduce__(...) | Helper for pickle. | | __repr__(self, /) | Return repr(self). | | __setstate__(...) | | __str__(self, /) | Return str(self). | | add_note(...) | Exception.add_note(note) -- | add a note to the exception | | with_traceback(...) | Exception.with_traceback(tb) -- | set self.__traceback__ to tb and return self. | | ---------------------------------------------------------------------- | Data descriptors inherited from builtins.BaseException: | | __cause__ | exception cause | | __context__ | exception context | | __dict__ | | __suppress_context__ | | __traceback__ | | args
pyjwt.ExpiredSignatureError
Python Library Documentation: class ExpiredSignatureError in module jwt.exceptions class ExpiredSignatureError(InvalidTokenError) | Raised when a token's ``exp`` claim indicates that it has expired | | Method resolution order: | ExpiredSignatureError | InvalidTokenError | PyJWTError | builtins.Exception | builtins.BaseException | builtins.object | | Data descriptors inherited from PyJWTError: | | __weakref__ | list of weak references to the object | | ---------------------------------------------------------------------- | Methods inherited from builtins.Exception: | | __init__(self, /, *args, **kwargs) | Initialize self. See help(type(self)) for accurate signature. | | ---------------------------------------------------------------------- | Static methods inherited from builtins.Exception: | | __new__(*args, **kwargs) class method of builtins.Exception | Create and return a new object. See help(type) for accurate signature. | | ---------------------------------------------------------------------- | Methods inherited from builtins.BaseException: | | __getattribute__(self, name, /) | Return getattr(self, name). | | __reduce__(...) | Helper for pickle. | | __repr__(self, /) | Return repr(self). | | __setstate__(...) | | __str__(self, /) | Return str(self). | | add_note(...) | Exception.add_note(note) -- | add a note to the exception | | with_traceback(...) | Exception.with_traceback(tb) -- | set self.__traceback__ to tb and return self. | | ---------------------------------------------------------------------- | Data descriptors inherited from builtins.BaseException: | | __cause__ | exception cause | | __context__ | exception context | | __dict__ | | __suppress_context__ | | __traceback__ | | args
pyjwt.ImmatureSignatureError
Python Library Documentation: class ImmatureSignatureError in module jwt.exceptions class ImmatureSignatureError(InvalidTokenError) | Raised when a token's ``nbf`` or ``iat`` claims represent a time in the future | | Method resolution order: | ImmatureSignatureError | InvalidTokenError | PyJWTError | builtins.Exception | builtins.BaseException | builtins.object | | Data descriptors inherited from PyJWTError: | | __weakref__ | list of weak references to the object | | ---------------------------------------------------------------------- | Methods inherited from builtins.Exception: | | __init__(self, /, *args, **kwargs) | Initialize self. See help(type(self)) for accurate signature. | | ---------------------------------------------------------------------- | Static methods inherited from builtins.Exception: | | __new__(*args, **kwargs) class method of builtins.Exception | Create and return a new object. See help(type) for accurate signature. | | ---------------------------------------------------------------------- | Methods inherited from builtins.BaseException: | | __getattribute__(self, name, /) | Return getattr(self, name). | | __reduce__(...) | Helper for pickle. | | __repr__(self, /) | Return repr(self). | | __setstate__(...) | | __str__(self, /) | Return str(self). | | add_note(...) | Exception.add_note(note) -- | add a note to the exception | | with_traceback(...) | Exception.with_traceback(tb) -- | set self.__traceback__ to tb and return self. | | ---------------------------------------------------------------------- | Data descriptors inherited from builtins.BaseException: | | __cause__ | exception cause | | __context__ | exception context | | __dict__ | | __suppress_context__ | | __traceback__ | | args
pyjwt.InsecureKeyLengthWarning
Python Library Documentation: class InsecureKeyLengthWarning in module jwt.warnings class InsecureKeyLengthWarning(builtins.UserWarning) | Warning emitted when a cryptographic key is shorter than the minimum | recommended length. See :ref:`key-length-validation` for details. | | Method resolution order: | InsecureKeyLengthWarning | builtins.UserWarning | builtins.Warning | builtins.Exception | builtins.BaseException | builtins.object | | Data descriptors defined here: | | __weakref__ | list of weak references to the object | | ---------------------------------------------------------------------- | Methods inherited from builtins.UserWarning: | | __init__(self, /, *args, **kwargs) | Initialize self. See help(type(self)) for accurate signature. | | ---------------------------------------------------------------------- | Static methods inherited from builtins.UserWarning: | | __new__(*args, **kwargs) class method of builtins.UserWarning | Create and return a new object. See help(type) for accurate signature. | | ---------------------------------------------------------------------- | Methods inherited from builtins.BaseException: | | __getattribute__(self, name, /) | Return getattr(self, name). | | __reduce__(...) | Helper for pickle. | | __repr__(self, /) | Return repr(self). | | __setstate__(...) | | __str__(self, /) | Return str(self). | | add_note(...) | Exception.add_note(note) -- | add a note to the exception | | with_traceback(...) | Exception.with_traceback(tb) -- | set self.__traceback__ to tb and return self. | | ---------------------------------------------------------------------- | Data descriptors inherited from builtins.BaseException: | | __cause__ | exception cause | | __context__ | exception context | | __dict__ | | __suppress_context__ | | __traceback__ | | args
pyjwt.InvalidAlgorithmError
Python Library Documentation: class InvalidAlgorithmError in module jwt.exceptions class InvalidAlgorithmError(InvalidTokenError) | Raised when the specified algorithm is not recognized by PyJWT | | Method resolution order: | InvalidAlgorithmError | InvalidTokenError | PyJWTError | builtins.Exception | builtins.BaseException | builtins.object | | Data descriptors inherited from PyJWTError: | | __weakref__ | list of weak references to the object | | ---------------------------------------------------------------------- | Methods inherited from builtins.Exception: | | __init__(self, /, *args, **kwargs) | Initialize self. See help(type(self)) for accurate signature. | | ---------------------------------------------------------------------- | Static methods inherited from builtins.Exception: | | __new__(*args, **kwargs) class method of builtins.Exception | Create and return a new object. See help(type) for accurate signature. | | ---------------------------------------------------------------------- | Methods inherited from builtins.BaseException: | | __getattribute__(self, name, /) | Return getattr(self, name). | | __reduce__(...) | Helper for pickle. | | __repr__(self, /) | Return repr(self). | | __setstate__(...) | | __str__(self, /) | Return str(self). | | add_note(...) | Exception.add_note(note) -- | add a note to the exception | | with_traceback(...) | Exception.with_traceback(tb) -- | set self.__traceback__ to tb and return self. | | ---------------------------------------------------------------------- | Data descriptors inherited from builtins.BaseException: | | __cause__ | exception cause | | __context__ | exception context | | __dict__ | | __suppress_context__ | | __traceback__ | | args
pyjwt.InvalidAudienceError
Python Library Documentation: class InvalidAudienceError in module jwt.exceptions class InvalidAudienceError(InvalidTokenError) | Raised when a token's ``aud`` claim does not match one of the expected | audience values | | Method resolution order: | InvalidAudienceError | InvalidTokenError | PyJWTError | builtins.Exception | builtins.BaseException | builtins.object | | Data descriptors inherited from PyJWTError: | | __weakref__ | list of weak references to the object | | ---------------------------------------------------------------------- | Methods inherited from builtins.Exception: | | __init__(self, /, *args, **kwargs) | Initialize self. See help(type(self)) for accurate signature. | | ---------------------------------------------------------------------- | Static methods inherited from builtins.Exception: | | __new__(*args, **kwargs) class method of builtins.Exception | Create and return a new object. See help(type) for accurate signature. | | ---------------------------------------------------------------------- | Methods inherited from builtins.BaseException: | | __getattribute__(self, name, /) | Return getattr(self, name). | | __reduce__(...) | Helper for pickle. | | __repr__(self, /) | Return repr(self). | | __setstate__(...) | | __str__(self, /) | Return str(self). | | add_note(...) | Exception.add_note(note) -- | add a note to the exception | | with_traceback(...) | Exception.with_traceback(tb) -- | set self.__traceback__ to tb and return self. | | ---------------------------------------------------------------------- | Data descriptors inherited from builtins.BaseException: | | __cause__ | exception cause | | __context__ | exception context | | __dict__ | | __suppress_context__ | | __traceback__ | | args
pyjwt.InvalidIssuedAtError
Python Library Documentation: class InvalidIssuedAtError in module jwt.exceptions class InvalidIssuedAtError(InvalidTokenError) | Raised when a token's ``iat`` claim is non-numeric | | Method resolution order: | InvalidIssuedAtError | InvalidTokenError | PyJWTError | builtins.Exception | builtins.BaseException | builtins.object | | Data descriptors inherited from PyJWTError: | | __weakref__ | list of weak references to the object | | ---------------------------------------------------------------------- | Methods inherited from builtins.Exception: | | __init__(self, /, *args, **kwargs) | Initialize self. See help(type(self)) for accurate signature. | | ---------------------------------------------------------------------- | Static methods inherited from builtins.Exception: | | __new__(*args, **kwargs) class method of builtins.Exception | Create and return a new object. See help(type) for accurate signature. | | ---------------------------------------------------------------------- | Methods inherited from builtins.BaseException: | | __getattribute__(self, name, /) | Return getattr(self, name). | | __reduce__(...) | Helper for pickle. | | __repr__(self, /) | Return repr(self). | | __setstate__(...) | | __str__(self, /) | Return str(self). | | add_note(...) | Exception.add_note(note) -- | add a note to the exception | | with_traceback(...) | Exception.with_traceback(tb) -- | set self.__traceback__ to tb and return self. | | ---------------------------------------------------------------------- | Data descriptors inherited from builtins.BaseException: | | __cause__ | exception cause | | __context__ | exception context | | __dict__ | | __suppress_context__ | | __traceback__ | | args
pyjwt.InvalidIssuerError
Python Library Documentation: class InvalidIssuerError in module jwt.exceptions class InvalidIssuerError(InvalidTokenError) | Raised when a token's ``iss`` claim does not match the expected issuer | | Method resolution order: | InvalidIssuerError | InvalidTokenError | PyJWTError | builtins.Exception | builtins.BaseException | builtins.object | | Data descriptors inherited from PyJWTError: | | __weakref__ | list of weak references to the object | | ---------------------------------------------------------------------- | Methods inherited from builtins.Exception: | | __init__(self, /, *args, **kwargs) | Initialize self. See help(type(self)) for accurate signature. | | ---------------------------------------------------------------------- | Static methods inherited from builtins.Exception: | | __new__(*args, **kwargs) class method of builtins.Exception | Create and return a new object. See help(type) for accurate signature. | | ---------------------------------------------------------------------- | Methods inherited from builtins.BaseException: | | __getattribute__(self, name, /) | Return getattr(self, name). | | __reduce__(...) | Helper for pickle. | | __repr__(self, /) | Return repr(self). | | __setstate__(...) | | __str__(self, /) | Return str(self). | | add_note(...) | Exception.add_note(note) -- | add a note to the exception | | with_traceback(...) | Exception.with_traceback(tb) -- | set self.__traceback__ to tb and return self. | | ---------------------------------------------------------------------- | Data descriptors inherited from builtins.BaseException: | | __cause__ | exception cause | | __context__ | exception context | | __dict__ | | __suppress_context__ | | __traceback__ | | args
pyjwt.InvalidKeyError
Python Library Documentation: class InvalidKeyError in module jwt.exceptions class InvalidKeyError(PyJWTError) | Raised when the specified key is not in the proper format | | Method resolution order: | InvalidKeyError | PyJWTError | builtins.Exception | builtins.BaseException | builtins.object | | Data descriptors inherited from PyJWTError: | | __weakref__ | list of weak references to the object | | ---------------------------------------------------------------------- | Methods inherited from builtins.Exception: | | __init__(self, /, *args, **kwargs) | Initialize self. See help(type(self)) for accurate signature. | | ---------------------------------------------------------------------- | Static methods inherited from builtins.Exception: | | __new__(*args, **kwargs) class method of builtins.Exception | Create and return a new object. See help(type) for accurate signature. | | ---------------------------------------------------------------------- | Methods inherited from builtins.BaseException: | | __getattribute__(self, name, /) | Return getattr(self, name). | | __reduce__(...) | Helper for pickle. | | __repr__(self, /) | Return repr(self). | | __setstate__(...) | | __str__(self, /) | Return str(self). | | add_note(...) | Exception.add_note(note) -- | add a note to the exception | | with_traceback(...) | Exception.with_traceback(tb) -- | set self.__traceback__ to tb and return self. | | ---------------------------------------------------------------------- | Data descriptors inherited from builtins.BaseException: | | __cause__ | exception cause | | __context__ | exception context | | __dict__ | | __suppress_context__ | | __traceback__ | | args
pyjwt.InvalidSignatureError
Python Library Documentation: class InvalidSignatureError in module jwt.exceptions class InvalidSignatureError(DecodeError) | Raised when a token's signature doesn't match the one provided as part of | the token. | | Method resolution order: | InvalidSignatureError | DecodeError | InvalidTokenError | PyJWTError | builtins.Exception | builtins.BaseException | builtins.object | | Data descriptors inherited from PyJWTError: | | __weakref__ | list of weak references to the object | | ---------------------------------------------------------------------- | Methods inherited from builtins.Exception: | | __init__(self, /, *args, **kwargs) | Initialize self. See help(type(self)) for accurate signature. | | ---------------------------------------------------------------------- | Static methods inherited from builtins.Exception: | | __new__(*args, **kwargs) class method of builtins.Exception | Create and return a new object. See help(type) for accurate signature. | | ---------------------------------------------------------------------- | Methods inherited from builtins.BaseException: | | __getattribute__(self, name, /) | Return getattr(self, name). | | __reduce__(...) | Helper for pickle. | | __repr__(self, /) | Return repr(self). | | __setstate__(...) | | __str__(self, /) | Return str(self). | | add_note(...) | Exception.add_note(note) -- | add a note to the exception | | with_traceback(...) | Exception.with_traceback(tb) -- | set self.__traceback__ to tb and return self. | | ---------------------------------------------------------------------- | Data descriptors inherited from builtins.BaseException: | | __cause__ | exception cause | | __context__ | exception context | | __dict__ | | __suppress_context__ | | __traceback__ | | args
pyjwt.InvalidTokenError
Python Library Documentation: class InvalidTokenError in module jwt.exceptions class InvalidTokenError(PyJWTError) | Base exception when ``decode()`` fails on a token | | Method resolution order: | InvalidTokenError | PyJWTError | builtins.Exception | builtins.BaseException | builtins.object | | Data descriptors inherited from PyJWTError: | | __weakref__ | list of weak references to the object | | ---------------------------------------------------------------------- | Methods inherited from builtins.Exception: | | __init__(self, /, *args, **kwargs) | Initialize self. See help(type(self)) for accurate signature. | | ---------------------------------------------------------------------- | Static methods inherited from builtins.Exception: | | __new__(*args, **kwargs) class method of builtins.Exception | Create and return a new object. See help(type) for accurate signature. | | ---------------------------------------------------------------------- | Methods inherited from builtins.BaseException: | | __getattribute__(self, name, /) | Return getattr(self, name). | | __reduce__(...) | Helper for pickle. | | __repr__(self, /) | Return repr(self). | | __setstate__(...) | | __str__(self, /) | Return str(self). | | add_note(...) | Exception.add_note(note) -- | add a note to the exception | | with_traceback(...) | Exception.with_traceback(tb) -- | set self.__traceback__ to tb and return self. | | ---------------------------------------------------------------------- | Data descriptors inherited from builtins.BaseException: | | __cause__ | exception cause | | __context__ | exception context | | __dict__ | | __suppress_context__ | | __traceback__ | | args
pyjwt.MissingRequiredClaimError
Python Library Documentation: class MissingRequiredClaimError in module jwt.exceptions class MissingRequiredClaimError(InvalidTokenError) | MissingRequiredClaimError(claim: str) -> None | | Raised when a claim that is required to be present is not contained | in the claimset | | Method resolution order: | MissingRequiredClaimError | InvalidTokenError | PyJWTError | builtins.Exception | builtins.BaseException | builtins.object | | Methods defined here: | | __init__(self, claim: str) -> None | Initialize self. See help(type(self)) for accurate signature. | | __str__(self) -> str | Return str(self). | | ---------------------------------------------------------------------- | Data descriptors inherited from PyJWTError: | | __weakref__ | list of weak references to the object | | ---------------------------------------------------------------------- | Static methods inherited from builtins.Exception: | | __new__(*args, **kwargs) class method of builtins.Exception | Create and return a new object. See help(type) for accurate signature. | | ---------------------------------------------------------------------- | Methods inherited from builtins.BaseException: | | __getattribute__(self, name, /) | Return getattr(self, name). | | __reduce__(...) | Helper for pickle. | | __repr__(self, /) | Return repr(self). | | __setstate__(...) | | add_note(...) | Exception.add_note(note) -- | add a note to the exception | | with_traceback(...) | Exception.with_traceback(tb) -- | set self.__traceback__ to tb and return self. | | ---------------------------------------------------------------------- | Data descriptors inherited from builtins.BaseException: | | __cause__ | exception cause | | __context__ | exception context | | __dict__ | | __suppress_context__ | | __traceback__ | | args
pyjwt.PyJWK
Python Library Documentation: class PyJWK in module jwt.api_jwk class PyJWK(builtins.object) | PyJWK(jwk_data: 'JWKDict', algorithm: 'str | None' = None) -> 'None' | | Methods defined here: | | __init__(self, jwk_data: 'JWKDict', algorithm: 'str | None' = None) -> 'None' | A class that represents a `JSON Web Key <https://www.rfc-editor.org/rfc/rfc7517>`_. | | :param jwk_data: The decoded JWK data. | :type jwk_data: dict[str, typing.Any] | :param algorithm: The key algorithm. If not specified, the key's ``alg`` will be used. | :type algorithm: str or None | :raises InvalidKeyError: If the key type (``kty``) is not found or unsupported, or if the curve (``crv``) is not found or unsupported. | :raises MissingCryptographyError: If the algorithm requires ``cryptography`` to be installed and it is not available. | :raises PyJWKError: If unable to find an algorithm for the key. | | ---------------------------------------------------------------------- | Static methods defined here: | | from_dict(obj: 'JWKDict', algorithm: 'str | None' = None) -> 'PyJWK' | Creates a :class:`PyJWK` object from a JSON-like dictionary. | | :param obj: The JWK data, as a dictionary | :type obj: dict[str, typing.Any] | :param algorithm: The key algorithm. If not specified, the key's ``alg`` will be used. | :type algorithm: str or None | :rtype: PyJWK | | from_json(data: 'str', algorithm: 'None' = None) -> 'PyJWK' | Create a :class:`PyJWK` object from a JSON string. | Implicitly calls :meth:`PyJWK.from_dict()`. | | :param str data: The JWK data, as a JSON string. | :param algorithm: The key algorithm. If not specific, the key's ``alg`` will be used. | :type algorithm: str or None | | :rtype: PyJWK | | ---------------------------------------------------------------------- | Readonly properties defined here: | | key_id | The `kid` property from the JWK. | | :rtype: str or None | | key_type | The `kty` property from the JWK. | | :rtype: str or None | | public_key_use | The `use` property from the JWK. | | :rtype: str or None | | ---------------------------------------------------------------------- | Data descriptors defined here: | | __dict__ | dictionary for instance variables | | __weakref__ | list of weak references to the object
pyjwt.PyJWKClient
Python Library Documentation: class PyJWKClient in module jwt.jwks_client class PyJWKClient(builtins.object) | PyJWKClient(uri: 'str', cache_keys: 'bool' = False, max_cached_keys: 'int' = 16, cache_jwk_set: 'bool' = True, lifespan: 'float' = 300, headers: 'dict[str, Any] | None' = None, timeout: 'float' = 30, ssl_context: 'SSLContext | None' = None) | | Methods defined here: | | __init__(self, uri: 'str', cache_keys: 'bool' = False, max_cached_keys: 'int' = 16, cache_jwk_set: 'bool' = True, lifespan: 'float' = 300, headers: 'dict[str, Any] | None' = None, timeout: 'float' = 30, ssl_context: 'SSLContext | None' = None) | A client for retrieving signing keys from a JWKS endpoint. | | ``PyJWKClient`` uses a two-tier caching system to avoid unnecessary | network requests: | | **Tier 1 — JWK Set cache** (enabled by default): | Caches the entire JSON Web Key Set response from the endpoint. | Controlled by: | | - ``cache_jwk_set``: Set to ``True`` (the default) to enable this | cache. When enabled, the JWK Set is fetched from the network only | when the cache is empty or expired. | - ``lifespan``: Time in seconds before the cached JWK Set expires. | Defaults to ``300`` (5 minutes). Must be greater than 0. | | **Tier 2 — Signing key cache** (disabled by default): | Caches individual signing keys (looked up by ``kid``) using an LRU | cache with **no time-based expiration**. Keys are evicted only when | the cache reaches its maximum size. Controlled by: | | - ``cache_keys``: Set to ``True`` to enable this cache. | Defaults to ``False``. | - ``max_cached_keys``: Maximum number of signing keys to keep in | the LRU cache. Defaults to ``16``. | | :param uri: The URL of the JWKS endpoint. | :type uri: str | :param cache_keys: Enable the per-key LRU cache (Tier 2). | :type cache_keys: bool | :param max_cached_keys: Max entries in the signing key LRU cache. | :type max_cached_keys: int | :param cache_jwk_set: Enable the JWK Set response cache (Tier 1). | :type cache_jwk_set: bool | :param lifespan: TTL in seconds for the JWK Set cache. | :type lifespan: float | :param headers: Optional HTTP headers to include in requests. | :type headers: dict or None | :param timeout: HTTP request timeout in seconds. | :type timeout: float | :param ssl_context: Optional SSL context for the request. | :type ssl_context: ssl.SSLContext or None | | fetch_data(self) -> 'Any' | Fetch the JWK Set from the JWKS endpoint. | | Makes an HTTP request to the configured ``uri`` and returns the | parsed JSON response. If the JWK Set cache is enabled, the | response is stored in the cache. | | :returns: The parsed JWK Set as a dictionary. | :raises PyJWKClientConnectionError: If the HTTP request fails. | | get_jwk_set(self, refresh: 'bool' = False) -> 'PyJWKSet' | Return the JWK Set, using the cache when available. | | :param refresh: Force a fresh fetch from the endpoint, bypassing | the cache. | :type refresh: bool | :returns: The JWK Set. | :rtype: PyJWKSet | :raises PyJWKClientError: If the endpoint does not return a JSON | object. | | get_signing_key(self, kid: 'str') -> 'PyJWK' | Return the signing key matching the given ``kid``. | | If no match is found in the current JWK Set, the set is | refreshed from the endpoint and the lookup is retried once. | | :param kid: The key ID to look up. | :type kid: str | :returns: The matching signing key. | :rtype: PyJWK | :raises PyJWKClientError: If no matching key is found after | refreshing. | | get_signing_key_from_jwt(self, token: 'str | bytes') -> 'PyJWK' | Return the signing key for a JWT by reading its ``kid`` header. | | Extracts the ``kid`` from the token's unverified header and | delegates to :meth:`get_signing_key`. | | :param token: The encoded JWT. | :type token: str or bytes | :returns: The matching signing key. | :rtype: PyJWK | | get_signing_keys(self, refresh: 'bool' = False) -> 'list[PyJWK]' | Return all signing keys from the JWK Set. | | Filters the JWK Set to keys whose ``use`` is ``"sig"`` (or | unspecified) and that have a ``kid``. | | :param refresh: Force a fresh fetch from the endpoint, bypassing | the cache. | :type refresh: bool | :returns: A list of signing keys. | :rtype: list[PyJWK] | :raises PyJWKClientError: If no signing keys are found. | | ---------------------------------------------------------------------- | Static methods defined here: | | match_kid(signing_keys: 'list[PyJWK]', kid: 'str') -> 'PyJWK | None' | Find a key in *signing_keys* that matches *kid*. | | :param signing_keys: The list of keys to search. | :type signing_keys: list[PyJWK] | :param kid: The key ID to match. | :type kid: str | :returns: The matching key, or ``None`` if not found. | :rtype: PyJWK or None | | ---------------------------------------------------------------------- | Data descriptors defined here: | | __dict__ | dictionary for instance variables | | __weakref__ | list of weak references to the object
pyjwt.PyJWKClientConnectionError
Python Library Documentation: class PyJWKClientConnectionError in module jwt.exceptions class PyJWKClientConnectionError(PyJWKClientError) | Method resolution order: | PyJWKClientConnectionError | PyJWKClientError | PyJWTError | builtins.Exception | builtins.BaseException | builtins.object | | Data descriptors inherited from PyJWTError: | | __weakref__ | list of weak references to the object | | ---------------------------------------------------------------------- | Methods inherited from builtins.Exception: | | __init__(self, /, *args, **kwargs) | Initialize self. See help(type(self)) for accurate signature. | | ---------------------------------------------------------------------- | Static methods inherited from builtins.Exception: | | __new__(*args, **kwargs) class method of builtins.Exception | Create and return a new object. See help(type) for accurate signature. | | ---------------------------------------------------------------------- | Methods inherited from builtins.BaseException: | | __getattribute__(self, name, /) | Return getattr(self, name). | | __reduce__(...) | Helper for pickle. | | __repr__(self, /) | Return repr(self). | | __setstate__(...) | | __str__(self, /) | Return str(self). | | add_note(...) | Exception.add_note(note) -- | add a note to the exception | | with_traceback(...) | Exception.with_traceback(tb) -- | set self.__traceback__ to tb and return self. | | ---------------------------------------------------------------------- | Data descriptors inherited from builtins.BaseException: | | __cause__ | exception cause | | __context__ | exception context | | __dict__ | | __suppress_context__ | | __traceback__ | | args
pyjwt.PyJWKClientError
Python Library Documentation: class PyJWKClientError in module jwt.exceptions class PyJWKClientError(PyJWTError) | Method resolution order: | PyJWKClientError | PyJWTError | builtins.Exception | builtins.BaseException | builtins.object | | Data descriptors inherited from PyJWTError: | | __weakref__ | list of weak references to the object | | ---------------------------------------------------------------------- | Methods inherited from builtins.Exception: | | __init__(self, /, *args, **kwargs) | Initialize self. See help(type(self)) for accurate signature. | | ---------------------------------------------------------------------- | Static methods inherited from builtins.Exception: | | __new__(*args, **kwargs) class method of builtins.Exception | Create and return a new object. See help(type) for accurate signature. | | ---------------------------------------------------------------------- | Methods inherited from builtins.BaseException: | | __getattribute__(self, name, /) | Return getattr(self, name). | | __reduce__(...) | Helper for pickle. | | __repr__(self, /) | Return repr(self). | | __setstate__(...) | | __str__(self, /) | Return str(self). | | add_note(...) | Exception.add_note(note) -- | add a note to the exception | | with_traceback(...) | Exception.with_traceback(tb) -- | set self.__traceback__ to tb and return self. | | ---------------------------------------------------------------------- | Data descriptors inherited from builtins.BaseException: | | __cause__ | exception cause | | __context__ | exception context | | __dict__ | | __suppress_context__ | | __traceback__ | | args
pyjwt.PyJWKError
Python Library Documentation: class PyJWKError in module jwt.exceptions class PyJWKError(PyJWTError) | Method resolution order: | PyJWKError | PyJWTError | builtins.Exception | builtins.BaseException | builtins.object | | Data descriptors inherited from PyJWTError: | | __weakref__ | list of weak references to the object | | ---------------------------------------------------------------------- | Methods inherited from builtins.Exception: | | __init__(self, /, *args, **kwargs) | Initialize self. See help(type(self)) for accurate signature. | | ---------------------------------------------------------------------- | Static methods inherited from builtins.Exception: | | __new__(*args, **kwargs) class method of builtins.Exception | Create and return a new object. See help(type) for accurate signature. | | ---------------------------------------------------------------------- | Methods inherited from builtins.BaseException: | | __getattribute__(self, name, /) | Return getattr(self, name). | | __reduce__(...) | Helper for pickle. | | __repr__(self, /) | Return repr(self). | | __setstate__(...) | | __str__(self, /) | Return str(self). | | add_note(...) | Exception.add_note(note) -- | add a note to the exception | | with_traceback(...) | Exception.with_traceback(tb) -- | set self.__traceback__ to tb and return self. | | ---------------------------------------------------------------------- | Data descriptors inherited from builtins.BaseException: | | __cause__ | exception cause | | __context__ | exception context | | __dict__ | | __suppress_context__ | | __traceback__ | | args
pyjwt.PyJWKSet
Python Library Documentation: class PyJWKSet in module jwt.api_jwk class PyJWKSet(builtins.object) | PyJWKSet(keys: 'list[JWKDict]') -> 'None' | | Methods defined here: | | __getitem__(self, kid: 'str') -> 'PyJWK' | | __init__(self, keys: 'list[JWKDict]') -> 'None' | Initialize self. See help(type(self)) for accurate signature. | | __iter__(self) -> 'Iterator[PyJWK]' | | ---------------------------------------------------------------------- | Static methods defined here: | | from_dict(obj: 'dict[str, Any]') -> 'PyJWKSet' | | from_json(data: 'str') -> 'PyJWKSet' | | ---------------------------------------------------------------------- | Data descriptors defined here: | | __dict__ | dictionary for instance variables | | __weakref__ | list of weak references to the object
pyjwt.PyJWKSetError
Python Library Documentation: class PyJWKSetError in module jwt.exceptions class PyJWKSetError(PyJWTError) | Method resolution order: | PyJWKSetError | PyJWTError | builtins.Exception | builtins.BaseException | builtins.object | | Data descriptors inherited from PyJWTError: | | __weakref__ | list of weak references to the object | | ---------------------------------------------------------------------- | Methods inherited from builtins.Exception: | | __init__(self, /, *args, **kwargs) | Initialize self. See help(type(self)) for accurate signature. | | ---------------------------------------------------------------------- | Static methods inherited from builtins.Exception: | | __new__(*args, **kwargs) class method of builtins.Exception | Create and return a new object. See help(type) for accurate signature. | | ---------------------------------------------------------------------- | Methods inherited from builtins.BaseException: | | __getattribute__(self, name, /) | Return getattr(self, name). | | __reduce__(...) | Helper for pickle. | | __repr__(self, /) | Return repr(self). | | __setstate__(...) | | __str__(self, /) | Return str(self). | | add_note(...) | Exception.add_note(note) -- | add a note to the exception | | with_traceback(...) | Exception.with_traceback(tb) -- | set self.__traceback__ to tb and return self. | | ---------------------------------------------------------------------- | Data descriptors inherited from builtins.BaseException: | | __cause__ | exception cause | | __context__ | exception context | | __dict__ | | __suppress_context__ | | __traceback__ | | args
pyjwt.PyJWS
Python Library Documentation: class PyJWS in module jwt.api_jws
class PyJWS(builtins.object)
| PyJWS(algorithms: 'Sequence[str] | None' = None, options: 'SigOptions | None' = None) -> 'None'
|
| Methods defined here:
|
| __init__(self, algorithms: 'Sequence[str] | None' = None, options: 'SigOptions | None' = None) -> 'None'
| Initialize self. See help(type(self)) for accurate signature.
|
| decode(self, jwt: 'str | bytes', key: 'AllowedPublicKeys | PyJWK | str | bytes' = '', algorithms: 'Sequence[str] | None' = None, options: 'SigOptions | None' = None, detached_payload: 'bytes | None' = None, **kwargs: 'dict[str, Any]') -> 'Any'
|
| decode_complete(self, jwt: 'str | bytes', key: 'AllowedPublicKeys | PyJWK | str | bytes' = '', algorithms: 'Sequence[str] | None' = None, options: 'SigOptions | None' = None, detached_payload: 'bytes | None' = None, **kwargs: 'dict[str, Any]') -> 'dict[str, Any]'
|
| encode(self, payload: 'bytes', key: 'AllowedPrivateKeys | PyJWK | str | bytes', algorithm: 'str | None' = <object object at 0x0000020613DC8B30>, headers: 'dict[str, Any] | None' = None, json_encoder: 'type[json.JSONEncoder] | None' = None, is_payload_detached: 'bool' = False, sort_headers: 'bool' = True) -> 'str'
|
| get_algorithm_by_name(self, alg_name: 'str') -> 'Algorithm'
| For a given string name, return the matching Algorithm object.
|
| Example usage:
| >>> jws_obj = PyJWS()
| >>> jws_obj.get_algorithm_by_name("RS256")
|
| :param alg_name: The name of the algorithm to retrieve
| :type alg_name: str
| :rtype: Algorithm
|
| get_algorithms(self) -> 'list[str]'
| Returns a list of supported values for the `alg` parameter.
|
| :rtype: list[str]
|
| get_unverified_header(self, jwt: 'str | bytes') -> 'dict[str, Any]'
| Returns back the JWT header parameters as a `dict`
|
| Note: The signature is not verified so the header parameters
| should not be fully trusted until signature verification is complete
|
| register_algorithm(self, alg_id: 'str', alg_obj: 'Algorithm') -> 'None'
| Registers a new Algorithm for use when creating and verifying tokens.
|
| :param str alg_id: the ID of the Algorithm
| :param alg_obj: the Algorithm object
| :type alg_obj: Algorithm
|
| unregister_algorithm(self, alg_id: 'str') -> 'None'
| Unregisters an Algorithm for use when creating and verifying tokens
| :param str alg_id: the ID of the Algorithm
| :raises KeyError: if algorithm is not registered.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __annotations__ = {'_supported_crit': 'set[str]'}
|
| header_typ = 'JWT'
pyjwt.PyJWT
Python Library Documentation: class PyJWT in module jwt.api_jwt class PyJWT(builtins.object) | PyJWT(options: 'Options | None' = None) -> 'None' | | Methods defined here: | | __init__(self, options: 'Options | None' = None) -> 'None' | Initialize self. See help(type(self)) for accurate signature. | | decode(self, jwt: 'str | bytes', key: 'AllowedPublicKeys | PyJWK | str | bytes' = '', algorithms: 'Sequence[str] | None' = None, options: 'Options | None' = None, verify: 'bool | None' = None, detached_payload: 'bytes | None' = None, audience: 'str | Iterable[str] | None' = None, subject: 'str | None' = None, issuer: 'str | Container[str] | None' = None, leeway: 'float | timedelta' = 0, **kwargs: 'Any') -> 'dict[str, Any]' | Verify the ``jwt`` token signature and return the token claims. | | :param jwt: the token to be decoded | :type jwt: str or bytes | :param key: the key suitable for the allowed algorithm | :type key: str or bytes or PyJWK or :py:class:`jwt.algorithms.AllowedPublicKeys` | | :param algorithms: allowed algorithms, e.g. ``["ES256"]`` | If ``key`` is a :class:`PyJWK` object, allowed algorithms will default to the key algorithm. | | .. warning:: | | Do **not** compute the ``algorithms`` parameter based on | the ``alg`` from the token itself, or on any other data | that an attacker may be able to influence, as that might | expose you to various vulnerabilities (see `RFC 8725 §2.1 | <https://www.rfc-editor.org/rfc/rfc8725.html#section-2.1>`_). Instead, | either hard-code a fixed value for ``algorithms``, or | configure it in the same place you configure the | ``key``. Make sure not to mix symmetric and asymmetric | algorithms that interpret the ``key`` in different ways | (e.g. HS\* and RS\*). | :type algorithms: typing.Sequence[str] or None | | :param jwt.types.Options options: extended decoding and validation options | Refer to :py:class:`jwt.types.Options` for more information. | | :param audience: optional, the value for ``verify_aud`` check | :type audience: str or typing.Iterable[str] or None | :param subject: optional, the value for ``verify_sub`` check | :type subject: str or None | :param issuer: optional, the value for ``verify_iss`` check | :type issuer: str or typing.Container[str] or None | :param leeway: a time margin in seconds for the expiration check | :type leeway: float or datetime.timedelta | :rtype: dict[str, typing.Any] | :returns: the JWT claims | | decode_complete(self, jwt: 'str | bytes', key: 'AllowedPublicKeyTypes' = '', algorithms: 'Sequence[str] | None' = None, options: 'Options | None' = None, verify: 'bool | None' = None, detached_payload: 'bytes | None' = None, audience: 'str | Iterable[str] | None' = None, issuer: 'str | Container[str] | None' = None, subject: 'str | None' = None, leeway: 'float | timedelta' = 0, **kwargs: 'Any') -> 'dict[str, Any]' | Identical to ``jwt.decode`` except for return value which is a dictionary containing the token header (JOSE Header), | the token payload (JWT Payload), and token signature (JWT Signature) on the keys "header", "payload", | and "signature" respectively. | | :param jwt: the token to be decoded | :type jwt: str or bytes | :param key: the key suitable for the allowed algorithm | :type key: str or bytes or PyJWK or :py:class:`jwt.algorithms.AllowedPublicKeys` | | :param algorithms: allowed algorithms, e.g. ``["ES256"]`` | | .. warning:: | | Do **not** compute the ``algorithms`` parameter based on | the ``alg`` from the token itself, or on any other data | that an attacker may be able to influence, as that might | expose you to various vulnerabilities (see `RFC 8725 §2.1 | <https://www.rfc-editor.org/rfc/rfc8725.html#section-2.1>`_). Instead, | either hard-code a fixed value for ``algorithms``, or | configure it in the same place you configure the | ``key``. Make sure not to mix symmetric and asymmetric | algorithms that interpret the ``key`` in different ways | (e.g. HS\* and RS\*). | :type algorithms: typing.Sequence[str] or None | | :param jwt.types.Options options: extended decoding and validation options | Refer to :py:class:`jwt.types.Options` for more information. | | :param audience: optional, the value for ``verify_aud`` check | :type audience: str or typing.Iterable[str] or None | :param issuer: optional, the value for ``verify_iss`` check | :type issuer: str or typing.Container[str] or None | :param leeway: a time margin in seconds for the expiration check | :type leeway: float or datetime.timedelta | :rtype: dict[str, typing.Any] | :returns: Decoded JWT with the JOSE Header on the key ``header``, the JWS | Payload on the key ``payload``, and the JWS Signature on the key ``signature``. | | encode(self, payload: 'dict[str, Any]', key: 'AllowedPrivateKeyTypes', algorithm: 'str | None' = <object object at 0x0000020613DC8B30>, headers: 'dict[str, Any] | None' = None, json_encoder: 'type[json.JSONEncoder] | None' = None, sort_headers: 'bool' = True) -> 'str' | Encode the ``payload`` as JSON Web Token. | | :param payload: JWT claims, e.g. ``dict(iss=..., aud=..., sub=...)`` | :type payload: dict[str, typing.Any] | :param key: a key suitable for the chosen algorithm: | | * for **asymmetric algorithms**: PEM-formatted private key, a multiline string | * for **symmetric algorithms**: plain string, sufficiently long for security | | :type key: str or bytes or PyJWK or :py:class:`jwt.algorithms.AllowedPrivateKeys` | :param algorithm: algorithm to sign the token with, e.g. ``"ES256"``. | If ``headers`` includes ``alg``, it will be preferred to this parameter. | If ``key`` is a :class:`PyJWK` object, by default the key algorithm will be used. | :type algorithm: str or None | :param headers: additional JWT header fields, e.g. ``dict(kid="my-key-id")``. | :type headers: dict[str, typing.Any] or None | :param json_encoder: custom JSON encoder for ``payload`` and ``headers`` | :type json_encoder: json.JSONEncoder or None | | :rtype: str | :returns: a JSON Web Token | | :raises TypeError: if ``payload`` is not a ``dict`` | | ---------------------------------------------------------------------- | Data descriptors defined here: | | __dict__ | dictionary for instance variables | | __weakref__ | list of weak references to the object
pyjwt.PyJWTError
Python Library Documentation: class PyJWTError in module jwt.exceptions class PyJWTError(builtins.Exception) | Base class for all exceptions | | Method resolution order: | PyJWTError | builtins.Exception | builtins.BaseException | builtins.object | | Data descriptors defined here: | | __weakref__ | list of weak references to the object | | ---------------------------------------------------------------------- | Methods inherited from builtins.Exception: | | __init__(self, /, *args, **kwargs) | Initialize self. See help(type(self)) for accurate signature. | | ---------------------------------------------------------------------- | Static methods inherited from builtins.Exception: | | __new__(*args, **kwargs) class method of builtins.Exception | Create and return a new object. See help(type) for accurate signature. | | ---------------------------------------------------------------------- | Methods inherited from builtins.BaseException: | | __getattribute__(self, name, /) | Return getattr(self, name). | | __reduce__(...) | Helper for pickle. | | __repr__(self, /) | Return repr(self). | | __setstate__(...) | | __str__(self, /) | Return str(self). | | add_note(...) | Exception.add_note(note) -- | add a note to the exception | | with_traceback(...) | Exception.with_traceback(tb) -- | set self.__traceback__ to tb and return self. | | ---------------------------------------------------------------------- | Data descriptors inherited from builtins.BaseException: | | __cause__ | exception cause | | __context__ | exception context | | __dict__ | | __suppress_context__ | | __traceback__ | | args
pyjwt.algorithms
Python Library Documentation: module jwt.algorithms in jwt
NAME
jwt.algorithms
CLASSES
abc.ABC(builtins.object)
Algorithm
ECAlgorithm
HMACAlgorithm
NoneAlgorithm
OKPAlgorithm
RSAAlgorithm
RSAPSSAlgorithm
class Algorithm(abc.ABC)
| The interface for an algorithm used to sign and verify tokens.
|
| Method resolution order:
| Algorithm
| abc.ABC
| builtins.object
|
| Methods defined here:
|
| check_crypto_key_type(self, key: 'PublicKeyTypes | PrivateKeyTypes') -> 'None'
| Check that the key belongs to the right cryptographic family.
|
| Note that this method only works when ``cryptography`` is installed.
|
| :param key: Potentially a cryptography key
| :type key: :py:data:`PublicKeyTypes <cryptography.hazmat.primitives.asymmetric.types.PublicKeyTypes>` | :py:data:`PrivateKeyTypes <cryptography.hazmat.primitives.asymmetric.types.PrivateKeyTypes>`
| :raises ValueError: if ``cryptography`` is not installed, or this method is called by a non-cryptography algorithm
| :raises InvalidKeyError: if the key doesn't match the expected key classes
|
| check_key_length(self, key: 'Any') -> 'str | None'
| Return a warning message if the key is below the minimum
| recommended length for this algorithm, or None if adequate.
|
| compute_hash_digest(self, bytestr: 'bytes') -> 'bytes'
| Compute a hash digest using the specified algorithm's hash algorithm.
|
| If there is no hash algorithm, raises a NotImplementedError.
|
| prepare_key(self, key: 'Any') -> 'Any'
| Performs necessary validation and conversions on the key and returns
| the key value in the proper format for sign() and verify().
|
| sign(self, msg: 'bytes', key: 'Any') -> 'bytes'
| Returns a digital signature for the specified message
| using the specified key value.
|
| verify(self, msg: 'bytes', key: 'Any', sig: 'bytes') -> 'bool'
| Verifies that the specified digital signature is valid
| for the specified message and key values.
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| from_jwk(jwk: 'str | JWKDict') -> 'Any'
| Deserializes a given key from JWK back into a key object
|
| to_jwk(key_obj: 'Any', as_dict: 'bool' = False) -> 'JWKDict | str'
| Serializes a given key into a JWK
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __abstractmethods__ = frozenset({'from_jwk', 'prepare_key', 'sign', 't...
|
| __annotations__ = {'_crypto_key_types': 'tuple[type[AllowedKeys], ...]...
class ECAlgorithm(Algorithm)
| ECAlgorithm(hash_alg: 'type[hashes.HashAlgorithm]', expected_curve: 'type[EllipticCurve] | None' = None) -> 'None'
|
| Performs signing and verification operations using
| ECDSA and the specified hash function
|
| Method resolution order:
| ECAlgorithm
| Algorithm
| abc.ABC
| builtins.object
|
| Methods defined here:
|
| __init__(self, hash_alg: 'type[hashes.HashAlgorithm]', expected_curve: 'type[EllipticCurve] | None' = None) -> 'None'
| Initialize self. See help(type(self)) for accurate signature.
|
| prepare_key(self, key: 'AllowedECKeys | str | bytes') -> 'AllowedECKeys'
| Performs necessary validation and conversions on the key and returns
| the key value in the proper format for sign() and verify().
|
| sign(self, msg: 'bytes', key: 'EllipticCurvePrivateKey') -> 'bytes'
| Returns a digital signature for the specified message
| using the specified key value.
|
| verify(self, msg: 'bytes', key: 'AllowedECKeys', sig: 'bytes') -> 'bool'
| Verifies that the specified digital signature is valid
| for the specified message and key values.
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| from_jwk(jwk: 'str | JWKDict') -> 'AllowedECKeys'
| Deserializes a given key from JWK back into a key object
|
| to_jwk(key_obj: 'AllowedECKeys', as_dict: 'bool' = False) -> 'JWKDict | str'
| Serializes a given key into a JWK
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| SHA256 = <class 'cryptography.hazmat.primitives.hashes.SHA256'>
|
| SHA384 = <class 'cryptography.hazmat.primitives.hashes.SHA384'>
|
| SHA512 = <class 'cryptography.hazmat.primitives.hashes.SHA512'>
|
| __abstractmethods__ = frozenset()
|
| __annotations__ = {'SHA256': 'ClassVar[type[hashes.HashAlgorithm]]', '...
|
| ----------------------------------------------------------------------
| Methods inherited from Algorithm:
|
| check_crypto_key_type(self, key: 'PublicKeyTypes | PrivateKeyTypes') -> 'None'
| Check that the key belongs to the right cryptographic family.
|
| Note that this method only works when ``cryptography`` is installed.
|
| :param key: Potentially a cryptography key
| :type key: :py:data:`PublicKeyTypes <cryptography.hazmat.primitives.asymmetric.types.PublicKeyTypes>` | :py:data:`PrivateKeyTypes <cryptography.hazmat.primitives.asymmetric.types.PrivateKeyTypes>`
| :raises ValueError: if ``cryptography`` is not installed, or this method is called by a non-cryptography algorithm
| :raises InvalidKeyError: if the key doesn't match the expected key classes
|
| check_key_length(self, key: 'Any') -> 'str | None'
| Return a warning message if the key is below the minimum
| recommended length for this algorithm, or None if adequate.
|
| compute_hash_digest(self, bytestr: 'bytes') -> 'bytes'
| Compute a hash digest using the specified algorithm's hash algorithm.
|
| If there is no hash algorithm, raises a NotImplementedError.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from Algorithm:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
class HMACAlgorithm(Algorithm)
| HMACAlgorithm(hash_alg: 'HashlibHash') -> 'None'
|
| Performs signing and verification operations using HMAC
| and the specified hash function.
|
| Method resolution order:
| HMACAlgorithm
| Algorithm
| abc.ABC
| builtins.object
|
| Methods defined here:
|
| __init__(self, hash_alg: 'HashlibHash') -> 'None'
| Initialize self. See help(type(self)) for accurate signature.
|
| check_key_length(self, key: 'bytes') -> 'str | None'
| Return a warning message if the key is below the minimum
| recommended length for this algorithm, or None if adequate.
|
| prepare_key(self, key: 'str | bytes') -> 'bytes'
| Performs necessary validation and conversions on the key and returns
| the key value in the proper format for sign() and verify().
|
| sign(self, msg: 'bytes', key: 'bytes') -> 'bytes'
| Returns a digital signature for the specified message
| using the specified key value.
|
| verify(self, msg: 'bytes', key: 'bytes', sig: 'bytes') -> 'bool'
| Verifies that the specified digital signature is valid
| for the specified message and key values.
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| SHA256 = openssl_sha256(string=b'', *, usedforsecurity=True)
| Returns a sha256 hash object; optionally initialized with a string
|
| SHA384 = openssl_sha384(string=b'', *, usedforsecurity=True)
| Returns a sha384 hash object; optionally initialized with a string
|
| SHA512 = openssl_sha512(string=b'', *, usedforsecurity=True)
| Returns a sha512 hash object; optionally initialized with a string
|
| from_jwk(jwk: 'str | JWKDict') -> 'bytes'
| Deserializes a given key from JWK back into a key object
|
| to_jwk(key_obj: 'str | bytes', as_dict: 'bool' = False) -> 'JWKDict | str'
| Serializes a given key into a JWK
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __abstractmethods__ = frozenset()
|
| __annotations__ = {'SHA256': 'ClassVar[HashlibHash]', 'SHA384': 'Class...
|
| ----------------------------------------------------------------------
| Methods inherited from Algorithm:
|
| check_crypto_key_type(self, key: 'PublicKeyTypes | PrivateKeyTypes') -> 'None'
| Check that the key belongs to the right cryptographic family.
|
| Note that this method only works when ``cryptography`` is installed.
|
| :param key: Potentially a cryptography key
| :type key: :py:data:`PublicKeyTypes <cryptography.hazmat.primitives.asymmetric.types.PublicKeyTypes>` | :py:data:`PrivateKeyTypes <cryptography.hazmat.primitives.asymmetric.types.PrivateKeyTypes>`
| :raises ValueError: if ``cryptography`` is not installed, or this method is called by a non-cryptography algorithm
| :raises InvalidKeyError: if the key doesn't match the expected key classes
|
| compute_hash_digest(self, bytestr: 'bytes') -> 'bytes'
| Compute a hash digest using the specified algorithm's hash algorithm.
|
| If there is no hash algorithm, raises a NotImplementedError.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from Algorithm:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
class NoneAlgorithm(Algorithm)
| Placeholder for use when no signing or verification
| operations are required.
|
| Method resolution order:
| NoneAlgorithm
| Algorithm
| abc.ABC
| builtins.object
|
| Methods defined here:
|
| prepare_key(self, key: 'str | None') -> 'None'
| Performs necessary validation and conversions on the key and returns
| the key value in the proper format for sign() and verify().
|
| sign(self, msg: 'bytes', key: 'None') -> 'bytes'
| Returns a digital signature for the specified message
| using the specified key value.
|
| verify(self, msg: 'bytes', key: 'None', sig: 'bytes') -> 'bool'
| Verifies that the specified digital signature is valid
| for the specified message and key values.
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| from_jwk(jwk: 'str | JWKDict') -> 'NoReturn'
| Deserializes a given key from JWK back into a key object
|
| to_jwk(key_obj: 'Any', as_dict: 'bool' = False) -> 'NoReturn'
| Serializes a given key into a JWK
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __abstractmethods__ = frozenset()
|
| __annotations__ = {}
|
| ----------------------------------------------------------------------
| Methods inherited from Algorithm:
|
| check_crypto_key_type(self, key: 'PublicKeyTypes | PrivateKeyTypes') -> 'None'
| Check that the key belongs to the right cryptographic family.
|
| Note that this method only works when ``cryptography`` is installed.
|
| :param key: Potentially a cryptography key
| :type key: :py:data:`PublicKeyTypes <cryptography.hazmat.primitives.asymmetric.types.PublicKeyTypes>` | :py:data:`PrivateKeyTypes <cryptography.hazmat.primitives.asymmetric.types.PrivateKeyTypes>`
| :raises ValueError: if ``cryptography`` is not installed, or this method is called by a non-cryptography algorithm
| :raises InvalidKeyError: if the key doesn't match the expected key classes
|
| check_key_length(self, key: 'Any') -> 'str | None'
| Return a warning message if the key is below the minimum
| recommended length for this algorithm, or None if adequate.
|
| compute_hash_digest(self, bytestr: 'bytes') -> 'bytes'
| Compute a hash digest using the specified algorithm's hash algorithm.
|
| If there is no hash algorithm, raises a NotImplementedError.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from Algorithm:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
class OKPAlgorithm(Algorithm)
| OKPAlgorithm(**kwargs: 'Any') -> 'None'
|
| Performs signing and verification operations using EdDSA
|
| This class requires ``cryptography>=2.6`` to be installed.
|
| Method resolution order:
| OKPAlgorithm
| Algorithm
| abc.ABC
| builtins.object
|
| Methods defined here:
|
| __init__(self, **kwargs: 'Any') -> 'None'
| Initialize self. See help(type(self)) for accurate signature.
|
| prepare_key(self, key: 'AllowedOKPKeys | str | bytes') -> 'AllowedOKPKeys'
| Performs necessary validation and conversions on the key and returns
| the key value in the proper format for sign() and verify().
|
| sign(self, msg: 'str | bytes', key: 'Ed25519PrivateKey | Ed448PrivateKey') -> 'bytes'
| Sign a message ``msg`` using the EdDSA private key ``key``
| :param str|bytes msg: Message to sign
| :param Ed25519PrivateKey}Ed448PrivateKey key: A :class:`.Ed25519PrivateKey`
| or :class:`.Ed448PrivateKey` isinstance
| :return bytes signature: The signature, as bytes
|
| verify(self, msg: 'str | bytes', key: 'AllowedOKPKeys', sig: 'str | bytes') -> 'bool'
| Verify a given ``msg`` against a signature ``sig`` using the EdDSA key ``key``
|
| :param str|bytes sig: EdDSA signature to check ``msg`` against
| :param str|bytes msg: Message to sign
| :param Ed25519PrivateKey|Ed25519PublicKey|Ed448PrivateKey|Ed448PublicKey key:
| A private or public EdDSA key instance
| :return bool verified: True if signature is valid, False if not.
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| from_jwk(jwk: 'str | JWKDict') -> 'AllowedOKPKeys'
| Deserializes a given key from JWK back into a key object
|
| to_jwk(key: 'AllowedOKPKeys', as_dict: 'bool' = False) -> 'JWKDict | str'
| Serializes a given key into a JWK
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __abstractmethods__ = frozenset()
|
| __annotations__ = {}
|
| ----------------------------------------------------------------------
| Methods inherited from Algorithm:
|
| check_crypto_key_type(self, key: 'PublicKeyTypes | PrivateKeyTypes') -> 'None'
| Check that the key belongs to the right cryptographic family.
|
| Note that this method only works when ``cryptography`` is installed.
|
| :param key: Potentially a cryptography key
| :type key: :py:data:`PublicKeyTypes <cryptography.hazmat.primitives.asymmetric.types.PublicKeyTypes>` | :py:data:`PrivateKeyTypes <cryptography.hazmat.primitives.asymmetric.types.PrivateKeyTypes>`
| :raises ValueError: if ``cryptography`` is not installed, or this method is called by a non-cryptography algorithm
| :raises InvalidKeyError: if the key doesn't match the expected key classes
|
| check_key_length(self, key: 'Any') -> 'str | None'
| Return a warning message if the key is below the minimum
| recommended length for this algorithm, or None if adequate.
|
| compute_hash_digest(self, bytestr: 'bytes') -> 'bytes'
| Compute a hash digest using the specified algorithm's hash algorithm.
|
| If there is no hash algorithm, raises a NotImplementedError.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from Algorithm:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
class RSAAlgorithm(Algorithm)
| RSAAlgorithm(hash_alg: 'type[hashes.HashAlgorithm]') -> 'None'
|
| Performs signing and verification operations using
| RSASSA-PKCS-v1_5 and the specified hash function.
|
| Method resolution order:
| RSAAlgorithm
| Algorithm
| abc.ABC
| builtins.object
|
| Methods defined here:
|
| __init__(self, hash_alg: 'type[hashes.HashAlgorithm]') -> 'None'
| Initialize self. See help(type(self)) for accurate signature.
|
| check_key_length(self, key: 'AllowedRSAKeys') -> 'str | None'
| Return a warning message if the key is below the minimum
| recommended length for this algorithm, or None if adequate.
|
| prepare_key(self, key: 'AllowedRSAKeys | str | bytes') -> 'AllowedRSAKeys'
| Performs necessary validation and conversions on the key and returns
| the key value in the proper format for sign() and verify().
|
| sign(self, msg: 'bytes', key: 'RSAPrivateKey') -> 'bytes'
| Returns a digital signature for the specified message
| using the specified key value.
|
| verify(self, msg: 'bytes', key: 'RSAPublicKey', sig: 'bytes') -> 'bool'
| Verifies that the specified digital signature is valid
| for the specified message and key values.
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| from_jwk(jwk: 'str | JWKDict') -> 'AllowedRSAKeys'
| Deserializes a given key from JWK back into a key object
|
| to_jwk(key_obj: 'AllowedRSAKeys', as_dict: 'bool' = False) -> 'JWKDict | str'
| Serializes a given key into a JWK
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| SHA256 = <class 'cryptography.hazmat.primitives.hashes.SHA256'>
|
| SHA384 = <class 'cryptography.hazmat.primitives.hashes.SHA384'>
|
| SHA512 = <class 'cryptography.hazmat.primitives.hashes.SHA512'>
|
| __abstractmethods__ = frozenset()
|
| __annotations__ = {'SHA256': 'ClassVar[type[hashes.HashAlgorithm]]', '...
|
| ----------------------------------------------------------------------
| Methods inherited from Algorithm:
|
| check_crypto_key_type(self, key: 'PublicKeyTypes | PrivateKeyTypes') -> 'None'
| Check that the key belongs to the right cryptographic family.
|
| Note that this method only works when ``cryptography`` is installed.
|
| :param key: Potentially a cryptography key
| :type key: :py:data:`PublicKeyTypes <cryptography.hazmat.primitives.asymmetric.types.PublicKeyTypes>` | :py:data:`PrivateKeyTypes <cryptography.hazmat.primitives.asymmetric.types.PrivateKeyTypes>`
| :raises ValueError: if ``cryptography`` is not installed, or this method is called by a non-cryptography algorithm
| :raises InvalidKeyError: if the key doesn't match the expected key classes
|
| compute_hash_digest(self, bytestr: 'bytes') -> 'bytes'
| Compute a hash digest using the specified algorithm's hash algorithm.
|
| If there is no hash algorithm, raises a NotImplementedError.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from Algorithm:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
class RSAPSSAlgorithm(RSAAlgorithm)
| RSAPSSAlgorithm(hash_alg: 'type[hashes.HashAlgorithm]') -> 'None'
|
| Performs a signature using RSASSA-PSS with MGF1
|
| Method resolution order:
| RSAPSSAlgorithm
| RSAAlgorithm
| Algorithm
| abc.ABC
| builtins.object
|
| Methods defined here:
|
| sign(self, msg: 'bytes', key: 'RSAPrivateKey') -> 'bytes'
| Returns a digital signature for the specified message
| using the specified key value.
|
| verify(self, msg: 'bytes', key: 'RSAPublicKey', sig: 'bytes') -> 'bool'
| Verifies that the specified digital signature is valid
| for the specified message and key values.
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __abstractmethods__ = frozenset()
|
| __annotations__ = {}
|
| ----------------------------------------------------------------------
| Methods inherited from RSAAlgorithm:
|
| __init__(self, hash_alg: 'type[hashes.HashAlgorithm]') -> 'None'
| Initialize self. See help(type(self)) for accurate signature.
|
| check_key_length(self, key: 'AllowedRSAKeys') -> 'str | None'
| Return a warning message if the key is below the minimum
| recommended length for this algorithm, or None if adequate.
|
| prepare_key(self, key: 'AllowedRSAKeys | str | bytes') -> 'AllowedRSAKeys'
| Performs necessary validation and conversions on the key and returns
| the key value in the proper format for sign() and verify().
|
| ----------------------------------------------------------------------
| Static methods inherited from RSAAlgorithm:
|
| from_jwk(jwk: 'str | JWKDict') -> 'AllowedRSAKeys'
| Deserializes a given key from JWK back into a key object
|
| to_jwk(key_obj: 'AllowedRSAKeys', as_dict: 'bool' = False) -> 'JWKDict | str'
| Serializes a given key into a JWK
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from RSAAlgorithm:
|
| SHA256 = <class 'cryptography.hazmat.primitives.hashes.SHA256'>
|
| SHA384 = <class 'cryptography.hazmat.primitives.hashes.SHA384'>
|
| SHA512 = <class 'cryptography.hazmat.primitives.hashes.SHA512'>
|
| ----------------------------------------------------------------------
| Methods inherited from Algorithm:
|
| check_crypto_key_type(self, key: 'PublicKeyTypes | PrivateKeyTypes') -> 'None'
| Check that the key belongs to the right cryptographic family.
|
| Note that this method only works when ``cryptography`` is installed.
|
| :param key: Potentially a cryptography key
| :type key: :py:data:`PublicKeyTypes <cryptography.hazmat.primitives.asymmetric.types.PublicKeyTypes>` | :py:data:`PrivateKeyTypes <cryptography.hazmat.primitives.asymmetric.types.PrivateKeyTypes>`
| :raises ValueError: if ``cryptography`` is not installed, or this method is called by a non-cryptography algorithm
| :raises InvalidKeyError: if the key doesn't match the expected key classes
|
| compute_hash_digest(self, bytestr: 'bytes') -> 'bytes'
| Compute a hash digest using the specified algorithm's hash algorithm.
|
| If there is no hash algorithm, raises a NotImplementedError.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from Algorithm:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
FUNCTIONS
get_default_algorithms() -> 'dict[str, Algorithm]'
Returns the algorithms that are implemented by the library.
load_pem_private_key(data, password, backend=None, *, unsafe_skip_rsa_key_validation=False)
load_pem_public_key(data, backend=None)
DATA
AllowedECKeys = typing.Union[cryptography.hazmat.primitives.asym....pr...
AllowedKeys = typing.Union[cryptography.hazmat.primitives.asym...azmat...
AllowedOKPKeys = typing.Union[cryptography.hazmat.primitives.asym...az...
AllowedPrivateKeys = typing.Union[cryptography.hazmat.primitives.asym....
AllowedPublicKeys = typing.Union[cryptography.hazmat.primitives.asym.....
AllowedRSAKeys = typing.Union[cryptography.hazmat.primitives.asym...hy...
ClassVar = typing.ClassVar
Special type construct to mark class variables.
An annotation wrapped in ClassVar indicates that a given
attribute is intended to be used as a class variable and
should not be set on instances of that class.
Usage::
class Starship:
stats: ClassVar[dict[str, int]] = {} # class variable
damage: int = 10 # instance variable
ClassVar accepts only types and cannot be further subscribed.
Note that ClassVar is not a class itself, and should not
be used with isinstance() or issubclass().
HashlibHash = typing.Callable[..., typing.Any]
JWKDict = dict[str, typing.Any]
Literal = typing.Literal
Special typing form to define literal types (a.k.a. value types).
This form can be used to indicate to type checkers that the corresponding
variable or function parameter has a value equivalent to the provided
literal (or one of several literals)::
def validate_simple(data: Any) -> Literal[True]: # always returns True
...
MODE = Literal['r', 'rb', 'w', 'wb']
def open_helper(file: str, mode: MODE) -> str:
...
open_helper('/some/path', 'r') # Passes type check
open_helper('/other/path', 'typo') # Error in type checker
Literal[...] cannot be subclassed. At runtime, an arbitrary value
is allowed as type argument to Literal[...], but type checkers may
impose restrictions.
NoReturn = typing.NoReturn
Special type indicating functions that never return.
Example::
from typing import NoReturn
def stop() -> NoReturn:
raise Exception('no way')
NoReturn can also be used as a bottom type, a type that
has no values. Starting in Python 3.11, the Never type should
be used for this concept instead. Type checkers should treat the two
equivalently.
TYPE_CHECKING = False
TypeAlias = typing.TypeAlias
Special form for marking type aliases.
Use TypeAlias to indicate that an assignment should
be recognized as a proper type alias definition by type
checkers.
For example::
Predicate: TypeAlias = Callable[..., bool]
It's invalid when used anywhere except as in the example above.
Union = typing.Union
Union type; Union[X, Y] means either X or Y.
On Python 3.10 and higher, the | operator
can also be used to denote unions;
X | Y means the same thing to the type checker as Union[X, Y].
To define a union, use e.g. Union[int, str]. Details:
- The arguments must be types and there must be at least one.
- None as an argument is a special case and is replaced by
type(None).
- Unions of unions are flattened, e.g.::
assert Union[Union[int, str], float] == Union[int, str, float]
- Unions of a single argument vanish, e.g.::
assert Union[int] == int # The constructor actually returns int
- Redundant arguments are skipped, e.g.::
assert Union[int, str, int] == Union[int, str]
- When comparing unions, the argument order is ignored, e.g.::
assert Union[int, str] == Union[str, int]
- You cannot subclass or instantiate a union.
- You can use Optional[X] as a shorthand for Union[X, None].
__annotations__ = {'AllowedECKeys': 'TypeAlias', 'AllowedKeys': 'TypeA...
has_crypto = True
requires_cryptography = {'ES256', 'ES256K', 'ES384', 'ES512', 'ES521',...
FILE
c:\users\youse\appdata\local\programs\python\python312\lib\site-packages\jwt\algorithms.py
pyjwt.api_jwk
Python Library Documentation: module jwt.api_jwk in jwt
NAME
jwt.api_jwk
CLASSES
builtins.object
PyJWK
PyJWKSet
PyJWTSetWithTimestamp
class PyJWK(builtins.object)
| PyJWK(jwk_data: 'JWKDict', algorithm: 'str | None' = None) -> 'None'
|
| Methods defined here:
|
| __init__(self, jwk_data: 'JWKDict', algorithm: 'str | None' = None) -> 'None'
| A class that represents a `JSON Web Key <https://www.rfc-editor.org/rfc/rfc7517>`_.
|
| :param jwk_data: The decoded JWK data.
| :type jwk_data: dict[str, typing.Any]
| :param algorithm: The key algorithm. If not specified, the key's ``alg`` will be used.
| :type algorithm: str or None
| :raises InvalidKeyError: If the key type (``kty``) is not found or unsupported, or if the curve (``crv``) is not found or unsupported.
| :raises MissingCryptographyError: If the algorithm requires ``cryptography`` to be installed and it is not available.
| :raises PyJWKError: If unable to find an algorithm for the key.
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| from_dict(obj: 'JWKDict', algorithm: 'str | None' = None) -> 'PyJWK'
| Creates a :class:`PyJWK` object from a JSON-like dictionary.
|
| :param obj: The JWK data, as a dictionary
| :type obj: dict[str, typing.Any]
| :param algorithm: The key algorithm. If not specified, the key's ``alg`` will be used.
| :type algorithm: str or None
| :rtype: PyJWK
|
| from_json(data: 'str', algorithm: 'None' = None) -> 'PyJWK'
| Create a :class:`PyJWK` object from a JSON string.
| Implicitly calls :meth:`PyJWK.from_dict()`.
|
| :param str data: The JWK data, as a JSON string.
| :param algorithm: The key algorithm. If not specific, the key's ``alg`` will be used.
| :type algorithm: str or None
|
| :rtype: PyJWK
|
| ----------------------------------------------------------------------
| Readonly properties defined here:
|
| key_id
| The `kid` property from the JWK.
|
| :rtype: str or None
|
| key_type
| The `kty` property from the JWK.
|
| :rtype: str or None
|
| public_key_use
| The `use` property from the JWK.
|
| :rtype: str or None
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
class PyJWKSet(builtins.object)
| PyJWKSet(keys: 'list[JWKDict]') -> 'None'
|
| Methods defined here:
|
| __getitem__(self, kid: 'str') -> 'PyJWK'
|
| __init__(self, keys: 'list[JWKDict]') -> 'None'
| Initialize self. See help(type(self)) for accurate signature.
|
| __iter__(self) -> 'Iterator[PyJWK]'
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| from_dict(obj: 'dict[str, Any]') -> 'PyJWKSet'
|
| from_json(data: 'str') -> 'PyJWKSet'
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
class PyJWTSetWithTimestamp(builtins.object)
| PyJWTSetWithTimestamp(jwk_set: 'PyJWKSet')
|
| Methods defined here:
|
| __init__(self, jwk_set: 'PyJWKSet')
| Initialize self. See help(type(self)) for accurate signature.
|
| get_jwk_set(self) -> 'PyJWKSet'
|
| get_timestamp(self) -> 'float'
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
DATA
JWKDict = dict[str, typing.Any]
has_crypto = True
requires_cryptography = {'ES256', 'ES256K', 'ES384', 'ES512', 'ES521',...
FILE
c:\users\youse\appdata\local\programs\python\python312\lib\site-packages\jwt\api_jwk.py
pyjwt.api_jws
Python Library Documentation: module jwt.api_jws in jwt
NAME
jwt.api_jws
CLASSES
builtins.object
PyJWS
class PyJWS(builtins.object)
| PyJWS(algorithms: 'Sequence[str] | None' = None, options: 'SigOptions | None' = None) -> 'None'
|
| Methods defined here:
|
| __init__(self, algorithms: 'Sequence[str] | None' = None, options: 'SigOptions | None' = None) -> 'None'
| Initialize self. See help(type(self)) for accurate signature.
|
| decode(self, jwt: 'str | bytes', key: 'AllowedPublicKeys | PyJWK | str | bytes' = '', algorithms: 'Sequence[str] | None' = None, options: 'SigOptions | None' = None, detached_payload: 'bytes | None' = None, **kwargs: 'dict[str, Any]') -> 'Any'
|
| decode_complete(self, jwt: 'str | bytes', key: 'AllowedPublicKeys | PyJWK | str | bytes' = '', algorithms: 'Sequence[str] | None' = None, options: 'SigOptions | None' = None, detached_payload: 'bytes | None' = None, **kwargs: 'dict[str, Any]') -> 'dict[str, Any]'
|
| encode(self, payload: 'bytes', key: 'AllowedPrivateKeys | PyJWK | str | bytes', algorithm: 'str | None' = <object object at 0x0000020613DC8B30>, headers: 'dict[str, Any] | None' = None, json_encoder: 'type[json.JSONEncoder] | None' = None, is_payload_detached: 'bool' = False, sort_headers: 'bool' = True) -> 'str'
|
| get_algorithm_by_name(self, alg_name: 'str') -> 'Algorithm'
| For a given string name, return the matching Algorithm object.
|
| Example usage:
| >>> jws_obj = PyJWS()
| >>> jws_obj.get_algorithm_by_name("RS256")
|
| :param alg_name: The name of the algorithm to retrieve
| :type alg_name: str
| :rtype: Algorithm
|
| get_algorithms(self) -> 'list[str]'
| Returns a list of supported values for the `alg` parameter.
|
| :rtype: list[str]
|
| get_unverified_header(self, jwt: 'str | bytes') -> 'dict[str, Any]'
| Returns back the JWT header parameters as a `dict`
|
| Note: The signature is not verified so the header parameters
| should not be fully trusted until signature verification is complete
|
| register_algorithm(self, alg_id: 'str', alg_obj: 'Algorithm') -> 'None'
| Registers a new Algorithm for use when creating and verifying tokens.
|
| :param str alg_id: the ID of the Algorithm
| :param alg_obj: the Algorithm object
| :type alg_obj: Algorithm
|
| unregister_algorithm(self, alg_id: 'str') -> 'None'
| Unregisters an Algorithm for use when creating and verifying tokens
| :param str alg_id: the ID of the Algorithm
| :raises KeyError: if algorithm is not registered.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __annotations__ = {'_supported_crit': 'set[str]'}
|
| header_typ = 'JWT'
FUNCTIONS
decode(jwt: 'str | bytes', key: 'AllowedPublicKeys | PyJWK | str | bytes' = '', algorithms: 'Sequence[str] | None' = None, options: 'SigOptions | None' = None, detached_payload: 'bytes | None' = None, **kwargs: 'dict[str, Any]') -> 'Any' method of PyJWS instance
decode_complete(jwt: 'str | bytes', key: 'AllowedPublicKeys | PyJWK | str | bytes' = '', algorithms: 'Sequence[str] | None' = None, options: 'SigOptions | None' = None, detached_payload: 'bytes | None' = None, **kwargs: 'dict[str, Any]') -> 'dict[str, Any]' method of PyJWS instance
encode(payload: 'bytes', key: 'AllowedPrivateKeys | PyJWK | str | bytes', algorithm: 'str | None' = <object object at 0x0000020613DC8B30>, headers: 'dict[str, Any] | None' = None, json_encoder: 'type[json.JSONEncoder] | None' = None, is_payload_detached: 'bool' = False, sort_headers: 'bool' = True) -> 'str' method of PyJWS instance
get_algorithm_by_name(alg_name: 'str') -> 'Algorithm' method of PyJWS instance
For a given string name, return the matching Algorithm object.
Example usage:
>>> jws_obj = PyJWS()
>>> jws_obj.get_algorithm_by_name("RS256")
:param alg_name: The name of the algorithm to retrieve
:type alg_name: str
:rtype: Algorithm
get_unverified_header(jwt: 'str | bytes') -> 'dict[str, Any]' method of PyJWS instance
Returns back the JWT header parameters as a `dict`
Note: The signature is not verified so the header parameters
should not be fully trusted until signature verification is complete
register_algorithm(alg_id: 'str', alg_obj: 'Algorithm') -> 'None' method of PyJWS instance
Registers a new Algorithm for use when creating and verifying tokens.
:param str alg_id: the ID of the Algorithm
:param alg_obj: the Algorithm object
:type alg_obj: Algorithm
unregister_algorithm(alg_id: 'str') -> 'None' method of PyJWS instance
Unregisters an Algorithm for use when creating and verifying tokens
:param str alg_id: the ID of the Algorithm
:raises KeyError: if algorithm is not registered.
DATA
TYPE_CHECKING = False
has_crypto = True
requires_cryptography = {'ES256', 'ES256K', 'ES384', 'ES512', 'ES521',...
FILE
c:\users\youse\appdata\local\programs\python\python312\lib\site-packages\jwt\api_jws.py
pyjwt.api_jwt
Python Library Documentation: module jwt.api_jwt in jwt
NAME
jwt.api_jwt
CLASSES
builtins.object
PyJWT
class PyJWT(builtins.object)
| PyJWT(options: 'Options | None' = None) -> 'None'
|
| Methods defined here:
|
| __init__(self, options: 'Options | None' = None) -> 'None'
| Initialize self. See help(type(self)) for accurate signature.
|
| decode(self, jwt: 'str | bytes', key: 'AllowedPublicKeys | PyJWK | str | bytes' = '', algorithms: 'Sequence[str] | None' = None, options: 'Options | None' = None, verify: 'bool | None' = None, detached_payload: 'bytes | None' = None, audience: 'str | Iterable[str] | None' = None, subject: 'str | None' = None, issuer: 'str | Container[str] | None' = None, leeway: 'float | timedelta' = 0, **kwargs: 'Any') -> 'dict[str, Any]'
| Verify the ``jwt`` token signature and return the token claims.
|
| :param jwt: the token to be decoded
| :type jwt: str or bytes
| :param key: the key suitable for the allowed algorithm
| :type key: str or bytes or PyJWK or :py:class:`jwt.algorithms.AllowedPublicKeys`
|
| :param algorithms: allowed algorithms, e.g. ``["ES256"]``
| If ``key`` is a :class:`PyJWK` object, allowed algorithms will default to the key algorithm.
|
| .. warning::
|
| Do **not** compute the ``algorithms`` parameter based on
| the ``alg`` from the token itself, or on any other data
| that an attacker may be able to influence, as that might
| expose you to various vulnerabilities (see `RFC 8725 §2.1
| <https://www.rfc-editor.org/rfc/rfc8725.html#section-2.1>`_). Instead,
| either hard-code a fixed value for ``algorithms``, or
| configure it in the same place you configure the
| ``key``. Make sure not to mix symmetric and asymmetric
| algorithms that interpret the ``key`` in different ways
| (e.g. HS\* and RS\*).
| :type algorithms: typing.Sequence[str] or None
|
| :param jwt.types.Options options: extended decoding and validation options
| Refer to :py:class:`jwt.types.Options` for more information.
|
| :param audience: optional, the value for ``verify_aud`` check
| :type audience: str or typing.Iterable[str] or None
| :param subject: optional, the value for ``verify_sub`` check
| :type subject: str or None
| :param issuer: optional, the value for ``verify_iss`` check
| :type issuer: str or typing.Container[str] or None
| :param leeway: a time margin in seconds for the expiration check
| :type leeway: float or datetime.timedelta
| :rtype: dict[str, typing.Any]
| :returns: the JWT claims
|
| decode_complete(self, jwt: 'str | bytes', key: 'AllowedPublicKeyTypes' = '', algorithms: 'Sequence[str] | None' = None, options: 'Options | None' = None, verify: 'bool | None' = None, detached_payload: 'bytes | None' = None, audience: 'str | Iterable[str] | None' = None, issuer: 'str | Container[str] | None' = None, subject: 'str | None' = None, leeway: 'float | timedelta' = 0, **kwargs: 'Any') -> 'dict[str, Any]'
| Identical to ``jwt.decode`` except for return value which is a dictionary containing the token header (JOSE Header),
| the token payload (JWT Payload), and token signature (JWT Signature) on the keys "header", "payload",
| and "signature" respectively.
|
| :param jwt: the token to be decoded
| :type jwt: str or bytes
| :param key: the key suitable for the allowed algorithm
| :type key: str or bytes or PyJWK or :py:class:`jwt.algorithms.AllowedPublicKeys`
|
| :param algorithms: allowed algorithms, e.g. ``["ES256"]``
|
| .. warning::
|
| Do **not** compute the ``algorithms`` parameter based on
| the ``alg`` from the token itself, or on any other data
| that an attacker may be able to influence, as that might
| expose you to various vulnerabilities (see `RFC 8725 §2.1
| <https://www.rfc-editor.org/rfc/rfc8725.html#section-2.1>`_). Instead,
| either hard-code a fixed value for ``algorithms``, or
| configure it in the same place you configure the
| ``key``. Make sure not to mix symmetric and asymmetric
| algorithms that interpret the ``key`` in different ways
| (e.g. HS\* and RS\*).
| :type algorithms: typing.Sequence[str] or None
|
| :param jwt.types.Options options: extended decoding and validation options
| Refer to :py:class:`jwt.types.Options` for more information.
|
| :param audience: optional, the value for ``verify_aud`` check
| :type audience: str or typing.Iterable[str] or None
| :param issuer: optional, the value for ``verify_iss`` check
| :type issuer: str or typing.Container[str] or None
| :param leeway: a time margin in seconds for the expiration check
| :type leeway: float or datetime.timedelta
| :rtype: dict[str, typing.Any]
| :returns: Decoded JWT with the JOSE Header on the key ``header``, the JWS
| Payload on the key ``payload``, and the JWS Signature on the key ``signature``.
|
| encode(self, payload: 'dict[str, Any]', key: 'AllowedPrivateKeyTypes', algorithm: 'str | None' = <object object at 0x0000020613DC8B30>, headers: 'dict[str, Any] | None' = None, json_encoder: 'type[json.JSONEncoder] | None' = None, sort_headers: 'bool' = True) -> 'str'
| Encode the ``payload`` as JSON Web Token.
|
| :param payload: JWT claims, e.g. ``dict(iss=..., aud=..., sub=...)``
| :type payload: dict[str, typing.Any]
| :param key: a key suitable for the chosen algorithm:
|
| * for **asymmetric algorithms**: PEM-formatted private key, a multiline string
| * for **symmetric algorithms**: plain string, sufficiently long for security
|
| :type key: str or bytes or PyJWK or :py:class:`jwt.algorithms.AllowedPrivateKeys`
| :param algorithm: algorithm to sign the token with, e.g. ``"ES256"``.
| If ``headers`` includes ``alg``, it will be preferred to this parameter.
| If ``key`` is a :class:`PyJWK` object, by default the key algorithm will be used.
| :type algorithm: str or None
| :param headers: additional JWT header fields, e.g. ``dict(kid="my-key-id")``.
| :type headers: dict[str, typing.Any] or None
| :param json_encoder: custom JSON encoder for ``payload`` and ``headers``
| :type json_encoder: json.JSONEncoder or None
|
| :rtype: str
| :returns: a JSON Web Token
|
| :raises TypeError: if ``payload`` is not a ``dict``
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
FUNCTIONS
decode(jwt: 'str | bytes', key: 'AllowedPublicKeys | PyJWK | str | bytes' = '', algorithms: 'Sequence[str] | None' = None, options: 'Options | None' = None, verify: 'bool | None' = None, detached_payload: 'bytes | None' = None, audience: 'str | Iterable[str] | None' = None, subject: 'str | None' = None, issuer: 'str | Container[str] | None' = None, leeway: 'float | timedelta' = 0, **kwargs: 'Any') -> 'dict[str, Any]' method of PyJWT instance
Verify the ``jwt`` token signature and return the token claims.
:param jwt: the token to be decoded
:type jwt: str or bytes
:param key: the key suitable for the allowed algorithm
:type key: str or bytes or PyJWK or :py:class:`jwt.algorithms.AllowedPublicKeys`
:param algorithms: allowed algorithms, e.g. ``["ES256"]``
If ``key`` is a :class:`PyJWK` object, allowed algorithms will default to the key algorithm.
.. warning::
Do **not** compute the ``algorithms`` parameter based on
the ``alg`` from the token itself, or on any other data
that an attacker may be able to influence, as that might
expose you to various vulnerabilities (see `RFC 8725 §2.1
<https://www.rfc-editor.org/rfc/rfc8725.html#section-2.1>`_). Instead,
either hard-code a fixed value for ``algorithms``, or
configure it in the same place you configure the
``key``. Make sure not to mix symmetric and asymmetric
algorithms that interpret the ``key`` in different ways
(e.g. HS\* and RS\*).
:type algorithms: typing.Sequence[str] or None
:param jwt.types.Options options: extended decoding and validation options
Refer to :py:class:`jwt.types.Options` for more information.
:param audience: optional, the value for ``verify_aud`` check
:type audience: str or typing.Iterable[str] or None
:param subject: optional, the value for ``verify_sub`` check
:type subject: str or None
:param issuer: optional, the value for ``verify_iss`` check
:type issuer: str or typing.Container[str] or None
:param leeway: a time margin in seconds for the expiration check
:type leeway: float or datetime.timedelta
:rtype: dict[str, typing.Any]
:returns: the JWT claims
decode_complete(jwt: 'str | bytes', key: 'AllowedPublicKeyTypes' = '', algorithms: 'Sequence[str] | None' = None, options: 'Options | None' = None, verify: 'bool | None' = None, detached_payload: 'bytes | None' = None, audience: 'str | Iterable[str] | None' = None, issuer: 'str | Container[str] | None' = None, subject: 'str | None' = None, leeway: 'float | timedelta' = 0, **kwargs: 'Any') -> 'dict[str, Any]' method of PyJWT instance
Identical to ``jwt.decode`` except for return value which is a dictionary containing the token header (JOSE Header),
the token payload (JWT Payload), and token signature (JWT Signature) on the keys "header", "payload",
and "signature" respectively.
:param jwt: the token to be decoded
:type jwt: str or bytes
:param key: the key suitable for the allowed algorithm
:type key: str or bytes or PyJWK or :py:class:`jwt.algorithms.AllowedPublicKeys`
:param algorithms: allowed algorithms, e.g. ``["ES256"]``
.. warning::
Do **not** compute the ``algorithms`` parameter based on
the ``alg`` from the token itself, or on any other data
that an attacker may be able to influence, as that might
expose you to various vulnerabilities (see `RFC 8725 §2.1
<https://www.rfc-editor.org/rfc/rfc8725.html#section-2.1>`_). Instead,
either hard-code a fixed value for ``algorithms``, or
configure it in the same place you configure the
``key``. Make sure not to mix symmetric and asymmetric
algorithms that interpret the ``key`` in different ways
(e.g. HS\* and RS\*).
:type algorithms: typing.Sequence[str] or None
:param jwt.types.Options options: extended decoding and validation options
Refer to :py:class:`jwt.types.Options` for more information.
:param audience: optional, the value for ``verify_aud`` check
:type audience: str or typing.Iterable[str] or None
:param issuer: optional, the value for ``verify_iss`` check
:type issuer: str or typing.Container[str] or None
:param leeway: a time margin in seconds for the expiration check
:type leeway: float or datetime.timedelta
:rtype: dict[str, typing.Any]
:returns: Decoded JWT with the JOSE Header on the key ``header``, the JWS
Payload on the key ``payload``, and the JWS Signature on the key ``signature``.
encode(payload: 'dict[str, Any]', key: 'AllowedPrivateKeyTypes', algorithm: 'str | None' = <object object at 0x0000020613DC8B30>, headers: 'dict[str, Any] | None' = None, json_encoder: 'type[json.JSONEncoder] | None' = None, sort_headers: 'bool' = True) -> 'str' method of PyJWT instance
Encode the ``payload`` as JSON Web Token.
:param payload: JWT claims, e.g. ``dict(iss=..., aud=..., sub=...)``
:type payload: dict[str, typing.Any]
:param key: a key suitable for the chosen algorithm:
* for **asymmetric algorithms**: PEM-formatted private key, a multiline string
* for **symmetric algorithms**: plain string, sufficiently long for security
:type key: str or bytes or PyJWK or :py:class:`jwt.algorithms.AllowedPrivateKeys`
:param algorithm: algorithm to sign the token with, e.g. ``"ES256"``.
If ``headers`` includes ``alg``, it will be preferred to this parameter.
If ``key`` is a :class:`PyJWK` object, by default the key algorithm will be used.
:type algorithm: str or None
:param headers: additional JWT header fields, e.g. ``dict(kid="my-key-id")``.
:type headers: dict[str, typing.Any] or None
:param json_encoder: custom JSON encoder for ``payload`` and ``headers``
:type json_encoder: json.JSONEncoder or None
:rtype: str
:returns: a JSON Web Token
:raises TypeError: if ``payload`` is not a ``dict``
DATA
TYPE_CHECKING = False
Union = typing.Union
Union type; Union[X, Y] means either X or Y.
On Python 3.10 and higher, the | operator
can also be used to denote unions;
X | Y means the same thing to the type checker as Union[X, Y].
To define a union, use e.g. Union[int, str]. Details:
- The arguments must be types and there must be at least one.
- None as an argument is a special case and is replaced by
type(None).
- Unions of unions are flattened, e.g.::
assert Union[Union[int, str], float] == Union[int, str, float]
- Unions of a single argument vanish, e.g.::
assert Union[int] == int # The constructor actually returns int
- Redundant arguments are skipped, e.g.::
assert Union[int, str, int] == Union[int, str]
- When comparing unions, the argument order is ignored, e.g.::
assert Union[int, str] == Union[str, int]
- You cannot subclass or instantiate a union.
- You can use Optional[X] as a shorthand for Union[X, None].
__annotations__ = {}
FILE
c:\users\youse\appdata\local\programs\python\python312\lib\site-packages\jwt\api_jwt.py
pyjwt.decode
Python Library Documentation: method decode in module jwt.api_jwt
decode(jwt: 'str | bytes', key: 'AllowedPublicKeys | PyJWK | str | bytes' = '', algorithms: 'Sequence[str] | None' = None, options: 'Options | None' = None, verify: 'bool | None' = None, detached_payload: 'bytes | None' = None, audience: 'str | Iterable[str] | None' = None, subject: 'str | None' = None, issuer: 'str | Container[str] | None' = None, leeway: 'float | timedelta' = 0, **kwargs: 'Any') -> 'dict[str, Any]' method of jwt.api_jwt.PyJWT instance
Verify the ``jwt`` token signature and return the token claims.
:param jwt: the token to be decoded
:type jwt: str or bytes
:param key: the key suitable for the allowed algorithm
:type key: str or bytes or PyJWK or :py:class:`jwt.algorithms.AllowedPublicKeys`
:param algorithms: allowed algorithms, e.g. ``["ES256"]``
If ``key`` is a :class:`PyJWK` object, allowed algorithms will default to the key algorithm.
.. warning::
Do **not** compute the ``algorithms`` parameter based on
the ``alg`` from the token itself, or on any other data
that an attacker may be able to influence, as that might
expose you to various vulnerabilities (see `RFC 8725 §2.1
<https://www.rfc-editor.org/rfc/rfc8725.html#section-2.1>`_). Instead,
either hard-code a fixed value for ``algorithms``, or
configure it in the same place you configure the
``key``. Make sure not to mix symmetric and asymmetric
algorithms that interpret the ``key`` in different ways
(e.g. HS\* and RS\*).
:type algorithms: typing.Sequence[str] or None
:param jwt.types.Options options: extended decoding and validation options
Refer to :py:class:`jwt.types.Options` for more information.
:param audience: optional, the value for ``verify_aud`` check
:type audience: str or typing.Iterable[str] or None
:param subject: optional, the value for ``verify_sub`` check
:type subject: str or None
:param issuer: optional, the value for ``verify_iss`` check
:type issuer: str or typing.Container[str] or None
:param leeway: a time margin in seconds for the expiration check
:type leeway: float or datetime.timedelta
:rtype: dict[str, typing.Any]
:returns: the JWT claims
pyjwt.decode_complete
Python Library Documentation: method decode_complete in module jwt.api_jwt
decode_complete(jwt: 'str | bytes', key: 'AllowedPublicKeyTypes' = '', algorithms: 'Sequence[str] | None' = None, options: 'Options | None' = None, verify: 'bool | None' = None, detached_payload: 'bytes | None' = None, audience: 'str | Iterable[str] | None' = None, issuer: 'str | Container[str] | None' = None, subject: 'str | None' = None, leeway: 'float | timedelta' = 0, **kwargs: 'Any') -> 'dict[str, Any]' method of jwt.api_jwt.PyJWT instance
Identical to ``jwt.decode`` except for return value which is a dictionary containing the token header (JOSE Header),
the token payload (JWT Payload), and token signature (JWT Signature) on the keys "header", "payload",
and "signature" respectively.
:param jwt: the token to be decoded
:type jwt: str or bytes
:param key: the key suitable for the allowed algorithm
:type key: str or bytes or PyJWK or :py:class:`jwt.algorithms.AllowedPublicKeys`
:param algorithms: allowed algorithms, e.g. ``["ES256"]``
.. warning::
Do **not** compute the ``algorithms`` parameter based on
the ``alg`` from the token itself, or on any other data
that an attacker may be able to influence, as that might
expose you to various vulnerabilities (see `RFC 8725 §2.1
<https://www.rfc-editor.org/rfc/rfc8725.html#section-2.1>`_). Instead,
either hard-code a fixed value for ``algorithms``, or
configure it in the same place you configure the
``key``. Make sure not to mix symmetric and asymmetric
algorithms that interpret the ``key`` in different ways
(e.g. HS\* and RS\*).
:type algorithms: typing.Sequence[str] or None
:param jwt.types.Options options: extended decoding and validation options
Refer to :py:class:`jwt.types.Options` for more information.
:param audience: optional, the value for ``verify_aud`` check
:type audience: str or typing.Iterable[str] or None
:param issuer: optional, the value for ``verify_iss`` check
:type issuer: str or typing.Container[str] or None
:param leeway: a time margin in seconds for the expiration check
:type leeway: float or datetime.timedelta
:rtype: dict[str, typing.Any]
:returns: Decoded JWT with the JOSE Header on the key ``header``, the JWS
Payload on the key ``payload``, and the JWS Signature on the key ``signature``.
pyjwt.encode
Python Library Documentation: method encode in module jwt.api_jwt
encode(payload: 'dict[str, Any]', key: 'AllowedPrivateKeyTypes', algorithm: 'str | None' = <object object at 0x0000020613DC8B30>, headers: 'dict[str, Any] | None' = None, json_encoder: 'type[json.JSONEncoder] | None' = None, sort_headers: 'bool' = True) -> 'str' method of jwt.api_jwt.PyJWT instance
Encode the ``payload`` as JSON Web Token.
:param payload: JWT claims, e.g. ``dict(iss=..., aud=..., sub=...)``
:type payload: dict[str, typing.Any]
:param key: a key suitable for the chosen algorithm:
* for **asymmetric algorithms**: PEM-formatted private key, a multiline string
* for **symmetric algorithms**: plain string, sufficiently long for security
:type key: str or bytes or PyJWK or :py:class:`jwt.algorithms.AllowedPrivateKeys`
:param algorithm: algorithm to sign the token with, e.g. ``"ES256"``.
If ``headers`` includes ``alg``, it will be preferred to this parameter.
If ``key`` is a :class:`PyJWK` object, by default the key algorithm will be used.
:type algorithm: str or None
:param headers: additional JWT header fields, e.g. ``dict(kid="my-key-id")``.
:type headers: dict[str, typing.Any] or None
:param json_encoder: custom JSON encoder for ``payload`` and ``headers``
:type json_encoder: json.JSONEncoder or None
:rtype: str
:returns: a JSON Web Token
:raises TypeError: if ``payload`` is not a ``dict``
pyjwt.exceptions
Python Library Documentation: module jwt.exceptions in jwt
NAME
jwt.exceptions
CLASSES
builtins.Exception(builtins.BaseException)
PyJWTError
InvalidKeyError
InvalidTokenError
DecodeError
InvalidSignatureError
ExpiredSignatureError
ImmatureSignatureError
InvalidAlgorithmError
InvalidAudienceError
InvalidIssuedAtError
InvalidIssuerError
InvalidJTIError
InvalidSubjectError
MissingRequiredClaimError
PyJWKClientError
PyJWKClientConnectionError
PyJWKError
MissingCryptographyError
PyJWKSetError
class DecodeError(InvalidTokenError)
| Raised when a token cannot be decoded because it failed validation
|
| Method resolution order:
| DecodeError
| InvalidTokenError
| PyJWTError
| builtins.Exception
| builtins.BaseException
| builtins.object
|
| Data descriptors inherited from PyJWTError:
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.Exception:
|
| __init__(self, /, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| ----------------------------------------------------------------------
| Static methods inherited from builtins.Exception:
|
| __new__(*args, **kwargs) class method of builtins.Exception
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.BaseException:
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __reduce__(...)
| Helper for pickle.
|
| __repr__(self, /)
| Return repr(self).
|
| __setstate__(...)
|
| __str__(self, /)
| Return str(self).
|
| add_note(...)
| Exception.add_note(note) --
| add a note to the exception
|
| with_traceback(...)
| Exception.with_traceback(tb) --
| set self.__traceback__ to tb and return self.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.BaseException:
|
| __cause__
| exception cause
|
| __context__
| exception context
|
| __dict__
|
| __suppress_context__
|
| __traceback__
|
| args
class ExpiredSignatureError(InvalidTokenError)
| Raised when a token's ``exp`` claim indicates that it has expired
|
| Method resolution order:
| ExpiredSignatureError
| InvalidTokenError
| PyJWTError
| builtins.Exception
| builtins.BaseException
| builtins.object
|
| Data descriptors inherited from PyJWTError:
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.Exception:
|
| __init__(self, /, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| ----------------------------------------------------------------------
| Static methods inherited from builtins.Exception:
|
| __new__(*args, **kwargs) class method of builtins.Exception
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.BaseException:
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __reduce__(...)
| Helper for pickle.
|
| __repr__(self, /)
| Return repr(self).
|
| __setstate__(...)
|
| __str__(self, /)
| Return str(self).
|
| add_note(...)
| Exception.add_note(note) --
| add a note to the exception
|
| with_traceback(...)
| Exception.with_traceback(tb) --
| set self.__traceback__ to tb and return self.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.BaseException:
|
| __cause__
| exception cause
|
| __context__
| exception context
|
| __dict__
|
| __suppress_context__
|
| __traceback__
|
| args
class ImmatureSignatureError(InvalidTokenError)
| Raised when a token's ``nbf`` or ``iat`` claims represent a time in the future
|
| Method resolution order:
| ImmatureSignatureError
| InvalidTokenError
| PyJWTError
| builtins.Exception
| builtins.BaseException
| builtins.object
|
| Data descriptors inherited from PyJWTError:
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.Exception:
|
| __init__(self, /, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| ----------------------------------------------------------------------
| Static methods inherited from builtins.Exception:
|
| __new__(*args, **kwargs) class method of builtins.Exception
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.BaseException:
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __reduce__(...)
| Helper for pickle.
|
| __repr__(self, /)
| Return repr(self).
|
| __setstate__(...)
|
| __str__(self, /)
| Return str(self).
|
| add_note(...)
| Exception.add_note(note) --
| add a note to the exception
|
| with_traceback(...)
| Exception.with_traceback(tb) --
| set self.__traceback__ to tb and return self.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.BaseException:
|
| __cause__
| exception cause
|
| __context__
| exception context
|
| __dict__
|
| __suppress_context__
|
| __traceback__
|
| args
class InvalidAlgorithmError(InvalidTokenError)
| Raised when the specified algorithm is not recognized by PyJWT
|
| Method resolution order:
| InvalidAlgorithmError
| InvalidTokenError
| PyJWTError
| builtins.Exception
| builtins.BaseException
| builtins.object
|
| Data descriptors inherited from PyJWTError:
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.Exception:
|
| __init__(self, /, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| ----------------------------------------------------------------------
| Static methods inherited from builtins.Exception:
|
| __new__(*args, **kwargs) class method of builtins.Exception
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.BaseException:
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __reduce__(...)
| Helper for pickle.
|
| __repr__(self, /)
| Return repr(self).
|
| __setstate__(...)
|
| __str__(self, /)
| Return str(self).
|
| add_note(...)
| Exception.add_note(note) --
| add a note to the exception
|
| with_traceback(...)
| Exception.with_traceback(tb) --
| set self.__traceback__ to tb and return self.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.BaseException:
|
| __cause__
| exception cause
|
| __context__
| exception context
|
| __dict__
|
| __suppress_context__
|
| __traceback__
|
| args
class InvalidAudienceError(InvalidTokenError)
| Raised when a token's ``aud`` claim does not match one of the expected
| audience values
|
| Method resolution order:
| InvalidAudienceError
| InvalidTokenError
| PyJWTError
| builtins.Exception
| builtins.BaseException
| builtins.object
|
| Data descriptors inherited from PyJWTError:
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.Exception:
|
| __init__(self, /, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| ----------------------------------------------------------------------
| Static methods inherited from builtins.Exception:
|
| __new__(*args, **kwargs) class method of builtins.Exception
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.BaseException:
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __reduce__(...)
| Helper for pickle.
|
| __repr__(self, /)
| Return repr(self).
|
| __setstate__(...)
|
| __str__(self, /)
| Return str(self).
|
| add_note(...)
| Exception.add_note(note) --
| add a note to the exception
|
| with_traceback(...)
| Exception.with_traceback(tb) --
| set self.__traceback__ to tb and return self.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.BaseException:
|
| __cause__
| exception cause
|
| __context__
| exception context
|
| __dict__
|
| __suppress_context__
|
| __traceback__
|
| args
class InvalidIssuedAtError(InvalidTokenError)
| Raised when a token's ``iat`` claim is non-numeric
|
| Method resolution order:
| InvalidIssuedAtError
| InvalidTokenError
| PyJWTError
| builtins.Exception
| builtins.BaseException
| builtins.object
|
| Data descriptors inherited from PyJWTError:
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.Exception:
|
| __init__(self, /, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| ----------------------------------------------------------------------
| Static methods inherited from builtins.Exception:
|
| __new__(*args, **kwargs) class method of builtins.Exception
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.BaseException:
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __reduce__(...)
| Helper for pickle.
|
| __repr__(self, /)
| Return repr(self).
|
| __setstate__(...)
|
| __str__(self, /)
| Return str(self).
|
| add_note(...)
| Exception.add_note(note) --
| add a note to the exception
|
| with_traceback(...)
| Exception.with_traceback(tb) --
| set self.__traceback__ to tb and return self.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.BaseException:
|
| __cause__
| exception cause
|
| __context__
| exception context
|
| __dict__
|
| __suppress_context__
|
| __traceback__
|
| args
class InvalidIssuerError(InvalidTokenError)
| Raised when a token's ``iss`` claim does not match the expected issuer
|
| Method resolution order:
| InvalidIssuerError
| InvalidTokenError
| PyJWTError
| builtins.Exception
| builtins.BaseException
| builtins.object
|
| Data descriptors inherited from PyJWTError:
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.Exception:
|
| __init__(self, /, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| ----------------------------------------------------------------------
| Static methods inherited from builtins.Exception:
|
| __new__(*args, **kwargs) class method of builtins.Exception
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.BaseException:
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __reduce__(...)
| Helper for pickle.
|
| __repr__(self, /)
| Return repr(self).
|
| __setstate__(...)
|
| __str__(self, /)
| Return str(self).
|
| add_note(...)
| Exception.add_note(note) --
| add a note to the exception
|
| with_traceback(...)
| Exception.with_traceback(tb) --
| set self.__traceback__ to tb and return self.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.BaseException:
|
| __cause__
| exception cause
|
| __context__
| exception context
|
| __dict__
|
| __suppress_context__
|
| __traceback__
|
| args
class InvalidJTIError(InvalidTokenError)
| Raised when a token's ``jti`` claim is not a string
|
| Method resolution order:
| InvalidJTIError
| InvalidTokenError
| PyJWTError
| builtins.Exception
| builtins.BaseException
| builtins.object
|
| Data descriptors inherited from PyJWTError:
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.Exception:
|
| __init__(self, /, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| ----------------------------------------------------------------------
| Static methods inherited from builtins.Exception:
|
| __new__(*args, **kwargs) class method of builtins.Exception
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.BaseException:
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __reduce__(...)
| Helper for pickle.
|
| __repr__(self, /)
| Return repr(self).
|
| __setstate__(...)
|
| __str__(self, /)
| Return str(self).
|
| add_note(...)
| Exception.add_note(note) --
| add a note to the exception
|
| with_traceback(...)
| Exception.with_traceback(tb) --
| set self.__traceback__ to tb and return self.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.BaseException:
|
| __cause__
| exception cause
|
| __context__
| exception context
|
| __dict__
|
| __suppress_context__
|
| __traceback__
|
| args
class InvalidKeyError(PyJWTError)
| Raised when the specified key is not in the proper format
|
| Method resolution order:
| InvalidKeyError
| PyJWTError
| builtins.Exception
| builtins.BaseException
| builtins.object
|
| Data descriptors inherited from PyJWTError:
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.Exception:
|
| __init__(self, /, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| ----------------------------------------------------------------------
| Static methods inherited from builtins.Exception:
|
| __new__(*args, **kwargs) class method of builtins.Exception
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.BaseException:
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __reduce__(...)
| Helper for pickle.
|
| __repr__(self, /)
| Return repr(self).
|
| __setstate__(...)
|
| __str__(self, /)
| Return str(self).
|
| add_note(...)
| Exception.add_note(note) --
| add a note to the exception
|
| with_traceback(...)
| Exception.with_traceback(tb) --
| set self.__traceback__ to tb and return self.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.BaseException:
|
| __cause__
| exception cause
|
| __context__
| exception context
|
| __dict__
|
| __suppress_context__
|
| __traceback__
|
| args
class InvalidSignatureError(DecodeError)
| Raised when a token's signature doesn't match the one provided as part of
| the token.
|
| Method resolution order:
| InvalidSignatureError
| DecodeError
| InvalidTokenError
| PyJWTError
| builtins.Exception
| builtins.BaseException
| builtins.object
|
| Data descriptors inherited from PyJWTError:
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.Exception:
|
| __init__(self, /, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| ----------------------------------------------------------------------
| Static methods inherited from builtins.Exception:
|
| __new__(*args, **kwargs) class method of builtins.Exception
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.BaseException:
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __reduce__(...)
| Helper for pickle.
|
| __repr__(self, /)
| Return repr(self).
|
| __setstate__(...)
|
| __str__(self, /)
| Return str(self).
|
| add_note(...)
| Exception.add_note(note) --
| add a note to the exception
|
| with_traceback(...)
| Exception.with_traceback(tb) --
| set self.__traceback__ to tb and return self.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.BaseException:
|
| __cause__
| exception cause
|
| __context__
| exception context
|
| __dict__
|
| __suppress_context__
|
| __traceback__
|
| args
class InvalidSubjectError(InvalidTokenError)
| Raised when a token's ``sub`` claim is not a string or doesn't match the expected ``subject``
|
| Method resolution order:
| InvalidSubjectError
| InvalidTokenError
| PyJWTError
| builtins.Exception
| builtins.BaseException
| builtins.object
|
| Data descriptors inherited from PyJWTError:
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.Exception:
|
| __init__(self, /, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| ----------------------------------------------------------------------
| Static methods inherited from builtins.Exception:
|
| __new__(*args, **kwargs) class method of builtins.Exception
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.BaseException:
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __reduce__(...)
| Helper for pickle.
|
| __repr__(self, /)
| Return repr(self).
|
| __setstate__(...)
|
| __str__(self, /)
| Return str(self).
|
| add_note(...)
| Exception.add_note(note) --
| add a note to the exception
|
| with_traceback(...)
| Exception.with_traceback(tb) --
| set self.__traceback__ to tb and return self.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.BaseException:
|
| __cause__
| exception cause
|
| __context__
| exception context
|
| __dict__
|
| __suppress_context__
|
| __traceback__
|
| args
class InvalidTokenError(PyJWTError)
| Base exception when ``decode()`` fails on a token
|
| Method resolution order:
| InvalidTokenError
| PyJWTError
| builtins.Exception
| builtins.BaseException
| builtins.object
|
| Data descriptors inherited from PyJWTError:
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.Exception:
|
| __init__(self, /, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| ----------------------------------------------------------------------
| Static methods inherited from builtins.Exception:
|
| __new__(*args, **kwargs) class method of builtins.Exception
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.BaseException:
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __reduce__(...)
| Helper for pickle.
|
| __repr__(self, /)
| Return repr(self).
|
| __setstate__(...)
|
| __str__(self, /)
| Return str(self).
|
| add_note(...)
| Exception.add_note(note) --
| add a note to the exception
|
| with_traceback(...)
| Exception.with_traceback(tb) --
| set self.__traceback__ to tb and return self.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.BaseException:
|
| __cause__
| exception cause
|
| __context__
| exception context
|
| __dict__
|
| __suppress_context__
|
| __traceback__
|
| args
class MissingCryptographyError(PyJWKError)
| Raised if the algorithm requires ``cryptography`` to be installed and it is not available.
|
| Method resolution order:
| MissingCryptographyError
| PyJWKError
| PyJWTError
| builtins.Exception
| builtins.BaseException
| builtins.object
|
| Data descriptors inherited from PyJWTError:
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.Exception:
|
| __init__(self, /, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| ----------------------------------------------------------------------
| Static methods inherited from builtins.Exception:
|
| __new__(*args, **kwargs) class method of builtins.Exception
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.BaseException:
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __reduce__(...)
| Helper for pickle.
|
| __repr__(self, /)
| Return repr(self).
|
| __setstate__(...)
|
| __str__(self, /)
| Return str(self).
|
| add_note(...)
| Exception.add_note(note) --
| add a note to the exception
|
| with_traceback(...)
| Exception.with_traceback(tb) --
| set self.__traceback__ to tb and return self.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.BaseException:
|
| __cause__
| exception cause
|
| __context__
| exception context
|
| __dict__
|
| __suppress_context__
|
| __traceback__
|
| args
class MissingRequiredClaimError(InvalidTokenError)
| MissingRequiredClaimError(claim: str) -> None
|
| Raised when a claim that is required to be present is not contained
| in the claimset
|
| Method resolution order:
| MissingRequiredClaimError
| InvalidTokenError
| PyJWTError
| builtins.Exception
| builtins.BaseException
| builtins.object
|
| Methods defined here:
|
| __init__(self, claim: str) -> None
| Initialize self. See help(type(self)) for accurate signature.
|
| __str__(self) -> str
| Return str(self).
|
| ----------------------------------------------------------------------
| Data descriptors inherited from PyJWTError:
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Static methods inherited from builtins.Exception:
|
| __new__(*args, **kwargs) class method of builtins.Exception
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.BaseException:
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __reduce__(...)
| Helper for pickle.
|
| __repr__(self, /)
| Return repr(self).
|
| __setstate__(...)
|
| add_note(...)
| Exception.add_note(note) --
| add a note to the exception
|
| with_traceback(...)
| Exception.with_traceback(tb) --
| set self.__traceback__ to tb and return self.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.BaseException:
|
| __cause__
| exception cause
|
| __context__
| exception context
|
| __dict__
|
| __suppress_context__
|
| __traceback__
|
| args
class PyJWKClientConnectionError(PyJWKClientError)
| Method resolution order:
| PyJWKClientConnectionError
| PyJWKClientError
| PyJWTError
| builtins.Exception
| builtins.BaseException
| builtins.object
|
| Data descriptors inherited from PyJWTError:
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.Exception:
|
| __init__(self, /, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| ----------------------------------------------------------------------
| Static methods inherited from builtins.Exception:
|
| __new__(*args, **kwargs) class method of builtins.Exception
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.BaseException:
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __reduce__(...)
| Helper for pickle.
|
| __repr__(self, /)
| Return repr(self).
|
| __setstate__(...)
|
| __str__(self, /)
| Return str(self).
|
| add_note(...)
| Exception.add_note(note) --
| add a note to the exception
|
| with_traceback(...)
| Exception.with_traceback(tb) --
| set self.__traceback__ to tb and return self.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.BaseException:
|
| __cause__
| exception cause
|
| __context__
| exception context
|
| __dict__
|
| __suppress_context__
|
| __traceback__
|
| args
class PyJWKClientError(PyJWTError)
| Method resolution order:
| PyJWKClientError
| PyJWTError
| builtins.Exception
| builtins.BaseException
| builtins.object
|
| Data descriptors inherited from PyJWTError:
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.Exception:
|
| __init__(self, /, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| ----------------------------------------------------------------------
| Static methods inherited from builtins.Exception:
|
| __new__(*args, **kwargs) class method of builtins.Exception
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.BaseException:
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __reduce__(...)
| Helper for pickle.
|
| __repr__(self, /)
| Return repr(self).
|
| __setstate__(...)
|
| __str__(self, /)
| Return str(self).
|
| add_note(...)
| Exception.add_note(note) --
| add a note to the exception
|
| with_traceback(...)
| Exception.with_traceback(tb) --
| set self.__traceback__ to tb and return self.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.BaseException:
|
| __cause__
| exception cause
|
| __context__
| exception context
|
| __dict__
|
| __suppress_context__
|
| __traceback__
|
| args
class PyJWKError(PyJWTError)
| Method resolution order:
| PyJWKError
| PyJWTError
| builtins.Exception
| builtins.BaseException
| builtins.object
|
| Data descriptors inherited from PyJWTError:
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.Exception:
|
| __init__(self, /, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| ----------------------------------------------------------------------
| Static methods inherited from builtins.Exception:
|
| __new__(*args, **kwargs) class method of builtins.Exception
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.BaseException:
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __reduce__(...)
| Helper for pickle.
|
| __repr__(self, /)
| Return repr(self).
|
| __setstate__(...)
|
| __str__(self, /)
| Return str(self).
|
| add_note(...)
| Exception.add_note(note) --
| add a note to the exception
|
| with_traceback(...)
| Exception.with_traceback(tb) --
| set self.__traceback__ to tb and return self.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.BaseException:
|
| __cause__
| exception cause
|
| __context__
| exception context
|
| __dict__
|
| __suppress_context__
|
| __traceback__
|
| args
class PyJWKSetError(PyJWTError)
| Method resolution order:
| PyJWKSetError
| PyJWTError
| builtins.Exception
| builtins.BaseException
| builtins.object
|
| Data descriptors inherited from PyJWTError:
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.Exception:
|
| __init__(self, /, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| ----------------------------------------------------------------------
| Static methods inherited from builtins.Exception:
|
| __new__(*args, **kwargs) class method of builtins.Exception
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.BaseException:
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __reduce__(...)
| Helper for pickle.
|
| __repr__(self, /)
| Return repr(self).
|
| __setstate__(...)
|
| __str__(self, /)
| Return str(self).
|
| add_note(...)
| Exception.add_note(note) --
| add a note to the exception
|
| with_traceback(...)
| Exception.with_traceback(tb) --
| set self.__traceback__ to tb and return self.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.BaseException:
|
| __cause__
| exception cause
|
| __context__
| exception context
|
| __dict__
|
| __suppress_context__
|
| __traceback__
|
| args
class PyJWTError(builtins.Exception)
| Base class for all exceptions
|
| Method resolution order:
| PyJWTError
| builtins.Exception
| builtins.BaseException
| builtins.object
|
| Data descriptors defined here:
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.Exception:
|
| __init__(self, /, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| ----------------------------------------------------------------------
| Static methods inherited from builtins.Exception:
|
| __new__(*args, **kwargs) class method of builtins.Exception
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.BaseException:
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __reduce__(...)
| Helper for pickle.
|
| __repr__(self, /)
| Return repr(self).
|
| __setstate__(...)
|
| __str__(self, /)
| Return str(self).
|
| add_note(...)
| Exception.add_note(note) --
| add a note to the exception
|
| with_traceback(...)
| Exception.with_traceback(tb) --
| set self.__traceback__ to tb and return self.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.BaseException:
|
| __cause__
| exception cause
|
| __context__
| exception context
|
| __dict__
|
| __suppress_context__
|
| __traceback__
|
| args
FILE
c:\users\youse\appdata\local\programs\python\python312\lib\site-packages\jwt\exceptions.py
pyjwt.get_algorithm_by_name
Python Library Documentation: method get_algorithm_by_name in module jwt.api_jws
get_algorithm_by_name(alg_name: 'str') -> 'Algorithm' method of jwt.api_jws.PyJWS instance
For a given string name, return the matching Algorithm object.
Example usage:
>>> jws_obj = PyJWS()
>>> jws_obj.get_algorithm_by_name("RS256")
:param alg_name: The name of the algorithm to retrieve
:type alg_name: str
:rtype: Algorithm
pyjwt.get_unverified_header
Python Library Documentation: method get_unverified_header in module jwt.api_jws
get_unverified_header(jwt: 'str | bytes') -> 'dict[str, Any]' method of jwt.api_jws.PyJWS instance
Returns back the JWT header parameters as a `dict`
Note: The signature is not verified so the header parameters
should not be fully trusted until signature verification is complete
pyjwt.jwk_set_cache
Python Library Documentation: module jwt.jwk_set_cache in jwt
NAME
jwt.jwk_set_cache
CLASSES
builtins.object
JWKSetCache
class JWKSetCache(builtins.object)
| JWKSetCache(lifespan: float) -> None
|
| Methods defined here:
|
| __init__(self, lifespan: float) -> None
| Initialize self. See help(type(self)) for accurate signature.
|
| get(self) -> Optional[jwt.api_jwk.PyJWKSet]
|
| is_expired(self) -> bool
|
| put(self, jwk_set: jwt.api_jwk.PyJWKSet) -> None
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
DATA
Optional = typing.Optional
Optional[X] is equivalent to Union[X, None].
FILE
c:\users\youse\appdata\local\programs\python\python312\lib\site-packages\jwt\jwk_set_cache.py
pyjwt.jwks_client
Python Library Documentation: module jwt.jwks_client in jwt
NAME
jwt.jwks_client
CLASSES
builtins.object
PyJWKClient
class PyJWKClient(builtins.object)
| PyJWKClient(uri: 'str', cache_keys: 'bool' = False, max_cached_keys: 'int' = 16, cache_jwk_set: 'bool' = True, lifespan: 'float' = 300, headers: 'dict[str, Any] | None' = None, timeout: 'float' = 30, ssl_context: 'SSLContext | None' = None)
|
| Methods defined here:
|
| __init__(self, uri: 'str', cache_keys: 'bool' = False, max_cached_keys: 'int' = 16, cache_jwk_set: 'bool' = True, lifespan: 'float' = 300, headers: 'dict[str, Any] | None' = None, timeout: 'float' = 30, ssl_context: 'SSLContext | None' = None)
| A client for retrieving signing keys from a JWKS endpoint.
|
| ``PyJWKClient`` uses a two-tier caching system to avoid unnecessary
| network requests:
|
| **Tier 1 — JWK Set cache** (enabled by default):
| Caches the entire JSON Web Key Set response from the endpoint.
| Controlled by:
|
| - ``cache_jwk_set``: Set to ``True`` (the default) to enable this
| cache. When enabled, the JWK Set is fetched from the network only
| when the cache is empty or expired.
| - ``lifespan``: Time in seconds before the cached JWK Set expires.
| Defaults to ``300`` (5 minutes). Must be greater than 0.
|
| **Tier 2 — Signing key cache** (disabled by default):
| Caches individual signing keys (looked up by ``kid``) using an LRU
| cache with **no time-based expiration**. Keys are evicted only when
| the cache reaches its maximum size. Controlled by:
|
| - ``cache_keys``: Set to ``True`` to enable this cache.
| Defaults to ``False``.
| - ``max_cached_keys``: Maximum number of signing keys to keep in
| the LRU cache. Defaults to ``16``.
|
| :param uri: The URL of the JWKS endpoint.
| :type uri: str
| :param cache_keys: Enable the per-key LRU cache (Tier 2).
| :type cache_keys: bool
| :param max_cached_keys: Max entries in the signing key LRU cache.
| :type max_cached_keys: int
| :param cache_jwk_set: Enable the JWK Set response cache (Tier 1).
| :type cache_jwk_set: bool
| :param lifespan: TTL in seconds for the JWK Set cache.
| :type lifespan: float
| :param headers: Optional HTTP headers to include in requests.
| :type headers: dict or None
| :param timeout: HTTP request timeout in seconds.
| :type timeout: float
| :param ssl_context: Optional SSL context for the request.
| :type ssl_context: ssl.SSLContext or None
|
| fetch_data(self) -> 'Any'
| Fetch the JWK Set from the JWKS endpoint.
|
| Makes an HTTP request to the configured ``uri`` and returns the
| parsed JSON response. If the JWK Set cache is enabled, the
| response is stored in the cache.
|
| :returns: The parsed JWK Set as a dictionary.
| :raises PyJWKClientConnectionError: If the HTTP request fails.
|
| get_jwk_set(self, refresh: 'bool' = False) -> 'PyJWKSet'
| Return the JWK Set, using the cache when available.
|
| :param refresh: Force a fresh fetch from the endpoint, bypassing
| the cache.
| :type refresh: bool
| :returns: The JWK Set.
| :rtype: PyJWKSet
| :raises PyJWKClientError: If the endpoint does not return a JSON
| object.
|
| get_signing_key(self, kid: 'str') -> 'PyJWK'
| Return the signing key matching the given ``kid``.
|
| If no match is found in the current JWK Set, the set is
| refreshed from the endpoint and the lookup is retried once.
|
| :param kid: The key ID to look up.
| :type kid: str
| :returns: The matching signing key.
| :rtype: PyJWK
| :raises PyJWKClientError: If no matching key is found after
| refreshing.
|
| get_signing_key_from_jwt(self, token: 'str | bytes') -> 'PyJWK'
| Return the signing key for a JWT by reading its ``kid`` header.
|
| Extracts the ``kid`` from the token's unverified header and
| delegates to :meth:`get_signing_key`.
|
| :param token: The encoded JWT.
| :type token: str or bytes
| :returns: The matching signing key.
| :rtype: PyJWK
|
| get_signing_keys(self, refresh: 'bool' = False) -> 'list[PyJWK]'
| Return all signing keys from the JWK Set.
|
| Filters the JWK Set to keys whose ``use`` is ``"sig"`` (or
| unspecified) and that have a ``kid``.
|
| :param refresh: Force a fresh fetch from the endpoint, bypassing
| the cache.
| :type refresh: bool
| :returns: A list of signing keys.
| :rtype: list[PyJWK]
| :raises PyJWKClientError: If no signing keys are found.
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| match_kid(signing_keys: 'list[PyJWK]', kid: 'str') -> 'PyJWK | None'
| Find a key in *signing_keys* that matches *kid*.
|
| :param signing_keys: The list of keys to search.
| :type signing_keys: list[PyJWK]
| :param kid: The key ID to match.
| :type kid: str
| :returns: The matching key, or ``None`` if not found.
| :rtype: PyJWK or None
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
FILE
c:\users\youse\appdata\local\programs\python\python312\lib\site-packages\jwt\jwks_client.py
pyjwt.register_algorithm
Python Library Documentation: method register_algorithm in module jwt.api_jws
register_algorithm(alg_id: 'str', alg_obj: 'Algorithm') -> 'None' method of jwt.api_jws.PyJWS instance
Registers a new Algorithm for use when creating and verifying tokens.
:param str alg_id: the ID of the Algorithm
:param alg_obj: the Algorithm object
:type alg_obj: Algorithm
pyjwt.types
Python Library Documentation: module jwt.types in jwt
NAME
jwt.types
CLASSES
builtins.dict(builtins.object)
FullOptions
Options
SigOptions
class FullOptions(builtins.dict)
| # The only difference between Options and FullOptions is that FullOptions
| # required _every_ value to be there; Options doesn't require any
|
| Method resolution order:
| FullOptions
| builtins.dict
| builtins.object
|
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __annotations__ = {'enforce_minimum_key_length': <class 'bool'>, 'requ...
|
| __optional_keys__ = frozenset()
|
| __orig_bases__ = (<function TypedDict>,)
|
| __required_keys__ = frozenset({'enforce_minimum_key_length', 'require'...
|
| __total__ = True
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.dict:
|
| __contains__(self, key, /)
| True if the dictionary has the specified key, else False.
|
| __delitem__(self, key, /)
| Delete self[key].
|
| __eq__(self, value, /)
| Return self==value.
|
| __ge__(self, value, /)
| Return self>=value.
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __getitem__(self, key, /)
| Return self[key].
|
| __gt__(self, value, /)
| Return self>value.
|
| __init__(self, /, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| __ior__(self, value, /)
| Return self|=value.
|
| __iter__(self, /)
| Implement iter(self).
|
| __le__(self, value, /)
| Return self<=value.
|
| __len__(self, /)
| Return len(self).
|
| __lt__(self, value, /)
| Return self<value.
|
| __ne__(self, value, /)
| Return self!=value.
|
| __or__(self, value, /)
| Return self|value.
|
| __repr__(self, /)
| Return repr(self).
|
| __reversed__(self, /)
| Return a reverse iterator over the dict keys.
|
| __ror__(self, value, /)
| Return value|self.
|
| __setitem__(self, key, value, /)
| Set self[key] to value.
|
| __sizeof__(...)
| D.__sizeof__() -> size of D in memory, in bytes
|
| clear(...)
| D.clear() -> None. Remove all items from D.
|
| copy(...)
| D.copy() -> a shallow copy of D
|
| get(self, key, default=None, /)
| Return the value for key if key is in the dictionary, else default.
|
| items(...)
| D.items() -> a set-like object providing a view on D's items
|
| keys(...)
| D.keys() -> a set-like object providing a view on D's keys
|
| pop(...)
| D.pop(k[,d]) -> v, remove specified key and return the corresponding value.
|
| If the key is not found, return the default if given; otherwise,
| raise a KeyError.
|
| popitem(self, /)
| Remove and return a (key, value) pair as a 2-tuple.
|
| Pairs are returned in LIFO (last-in, first-out) order.
| Raises KeyError if the dict is empty.
|
| setdefault(self, key, default=None, /)
| Insert key with a value of default if key is not in the dictionary.
|
| Return the value for key if key is in the dictionary, else default.
|
| update(...)
| D.update([E, ]**F) -> None. Update D from dict/iterable E and F.
| If E is present and has a .keys() method, then does: for k in E: D[k] = E[k]
| If E is present and lacks a .keys() method, then does: for k, v in E: D[k] = v
| In either case, this is followed by: for k in F: D[k] = F[k]
|
| values(...)
| D.values() -> an object providing a view on D's values
|
| ----------------------------------------------------------------------
| Class methods inherited from builtins.dict:
|
| __class_getitem__(...)
| See PEP 585
|
| fromkeys(iterable, value=None, /)
| Create a new dictionary with keys from iterable and values set to value.
|
| ----------------------------------------------------------------------
| Static methods inherited from builtins.dict:
|
| __new__(*args, **kwargs) class method of builtins.dict
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from builtins.dict:
|
| __hash__ = None
class Options(builtins.dict)
| Options for :py:func:`jwt.decode()` and :py:func:`jwt.decode_complete()` (TypedDict).
|
| .. warning::
|
| Some claims, such as ``exp``, ``iat``, ``jti``, ``nbf``, and ``sub``,
| will only be verified if present. Please refer to the documentation below
| for which ones, and make sure to include them in the ``require`` param
| if you want to make sure that they are always present (and therefore always verified
| if ``verify_{claim} = True`` for that claim).
|
| Method resolution order:
| Options
| builtins.dict
| builtins.object
|
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __annotations__ = {'enforce_minimum_key_length': <class 'bool'>, 'requ...
|
| __optional_keys__ = frozenset({'enforce_minimum_key_length', 'require'...
|
| __orig_bases__ = (<function TypedDict>,)
|
| __required_keys__ = frozenset()
|
| __total__ = False
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.dict:
|
| __contains__(self, key, /)
| True if the dictionary has the specified key, else False.
|
| __delitem__(self, key, /)
| Delete self[key].
|
| __eq__(self, value, /)
| Return self==value.
|
| __ge__(self, value, /)
| Return self>=value.
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __getitem__(self, key, /)
| Return self[key].
|
| __gt__(self, value, /)
| Return self>value.
|
| __init__(self, /, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| __ior__(self, value, /)
| Return self|=value.
|
| __iter__(self, /)
| Implement iter(self).
|
| __le__(self, value, /)
| Return self<=value.
|
| __len__(self, /)
| Return len(self).
|
| __lt__(self, value, /)
| Return self<value.
|
| __ne__(self, value, /)
| Return self!=value.
|
| __or__(self, value, /)
| Return self|value.
|
| __repr__(self, /)
| Return repr(self).
|
| __reversed__(self, /)
| Return a reverse iterator over the dict keys.
|
| __ror__(self, value, /)
| Return value|self.
|
| __setitem__(self, key, value, /)
| Set self[key] to value.
|
| __sizeof__(...)
| D.__sizeof__() -> size of D in memory, in bytes
|
| clear(...)
| D.clear() -> None. Remove all items from D.
|
| copy(...)
| D.copy() -> a shallow copy of D
|
| get(self, key, default=None, /)
| Return the value for key if key is in the dictionary, else default.
|
| items(...)
| D.items() -> a set-like object providing a view on D's items
|
| keys(...)
| D.keys() -> a set-like object providing a view on D's keys
|
| pop(...)
| D.pop(k[,d]) -> v, remove specified key and return the corresponding value.
|
| If the key is not found, return the default if given; otherwise,
| raise a KeyError.
|
| popitem(self, /)
| Remove and return a (key, value) pair as a 2-tuple.
|
| Pairs are returned in LIFO (last-in, first-out) order.
| Raises KeyError if the dict is empty.
|
| setdefault(self, key, default=None, /)
| Insert key with a value of default if key is not in the dictionary.
|
| Return the value for key if key is in the dictionary, else default.
|
| update(...)
| D.update([E, ]**F) -> None. Update D from dict/iterable E and F.
| If E is present and has a .keys() method, then does: for k in E: D[k] = E[k]
| If E is present and lacks a .keys() method, then does: for k, v in E: D[k] = v
| In either case, this is followed by: for k in F: D[k] = F[k]
|
| values(...)
| D.values() -> an object providing a view on D's values
|
| ----------------------------------------------------------------------
| Class methods inherited from builtins.dict:
|
| __class_getitem__(...)
| See PEP 585
|
| fromkeys(iterable, value=None, /)
| Create a new dictionary with keys from iterable and values set to value.
|
| ----------------------------------------------------------------------
| Static methods inherited from builtins.dict:
|
| __new__(*args, **kwargs) class method of builtins.dict
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from builtins.dict:
|
| __hash__ = None
class SigOptions(builtins.dict)
| Options for PyJWS class (TypedDict). Note that this is a smaller set of options than
| for :py:func:`jwt.decode()`.
|
| Method resolution order:
| SigOptions
| builtins.dict
| builtins.object
|
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __annotations__ = {'enforce_minimum_key_length': <class 'bool'>, 'veri...
|
| __optional_keys__ = frozenset({'enforce_minimum_key_length', 'verify_s...
|
| __orig_bases__ = (<function TypedDict>,)
|
| __required_keys__ = frozenset()
|
| __total__ = False
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.dict:
|
| __contains__(self, key, /)
| True if the dictionary has the specified key, else False.
|
| __delitem__(self, key, /)
| Delete self[key].
|
| __eq__(self, value, /)
| Return self==value.
|
| __ge__(self, value, /)
| Return self>=value.
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __getitem__(self, key, /)
| Return self[key].
|
| __gt__(self, value, /)
| Return self>value.
|
| __init__(self, /, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| __ior__(self, value, /)
| Return self|=value.
|
| __iter__(self, /)
| Implement iter(self).
|
| __le__(self, value, /)
| Return self<=value.
|
| __len__(self, /)
| Return len(self).
|
| __lt__(self, value, /)
| Return self<value.
|
| __ne__(self, value, /)
| Return self!=value.
|
| __or__(self, value, /)
| Return self|value.
|
| __repr__(self, /)
| Return repr(self).
|
| __reversed__(self, /)
| Return a reverse iterator over the dict keys.
|
| __ror__(self, value, /)
| Return value|self.
|
| __setitem__(self, key, value, /)
| Set self[key] to value.
|
| __sizeof__(...)
| D.__sizeof__() -> size of D in memory, in bytes
|
| clear(...)
| D.clear() -> None. Remove all items from D.
|
| copy(...)
| D.copy() -> a shallow copy of D
|
| get(self, key, default=None, /)
| Return the value for key if key is in the dictionary, else default.
|
| items(...)
| D.items() -> a set-like object providing a view on D's items
|
| keys(...)
| D.keys() -> a set-like object providing a view on D's keys
|
| pop(...)
| D.pop(k[,d]) -> v, remove specified key and return the corresponding value.
|
| If the key is not found, return the default if given; otherwise,
| raise a KeyError.
|
| popitem(self, /)
| Remove and return a (key, value) pair as a 2-tuple.
|
| Pairs are returned in LIFO (last-in, first-out) order.
| Raises KeyError if the dict is empty.
|
| setdefault(self, key, default=None, /)
| Insert key with a value of default if key is not in the dictionary.
|
| Return the value for key if key is in the dictionary, else default.
|
| update(...)
| D.update([E, ]**F) -> None. Update D from dict/iterable E and F.
| If E is present and has a .keys() method, then does: for k in E: D[k] = E[k]
| If E is present and lacks a .keys() method, then does: for k, v in E: D[k] = v
| In either case, this is followed by: for k in F: D[k] = F[k]
|
| values(...)
| D.values() -> an object providing a view on D's values
|
| ----------------------------------------------------------------------
| Class methods inherited from builtins.dict:
|
| __class_getitem__(...)
| See PEP 585
|
| fromkeys(iterable, value=None, /)
| Create a new dictionary with keys from iterable and values set to value.
|
| ----------------------------------------------------------------------
| Static methods inherited from builtins.dict:
|
| __new__(*args, **kwargs) class method of builtins.dict
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from builtins.dict:
|
| __hash__ = None
DATA
Callable = typing.Callable
Deprecated alias to collections.abc.Callable.
Callable[[int], str] signifies a function that takes a single
parameter of type int and returns a str.
The subscription syntax must always be used with exactly two
values: the argument list and the return type.
The argument list must be a list of types, a ParamSpec,
Concatenate or ellipsis. The return type must be a single type.
There is no syntax to indicate optional or keyword arguments;
such function types are rarely used as callback types.
HashlibHash = typing.Callable[..., typing.Any]
JWKDict = dict[str, typing.Any]
FILE
c:\users\youse\appdata\local\programs\python\python312\lib\site-packages\jwt\types.py
pyjwt.unregister_algorithm
Python Library Documentation: method unregister_algorithm in module jwt.api_jws
unregister_algorithm(alg_id: 'str') -> 'None' method of jwt.api_jws.PyJWS instance
Unregisters an Algorithm for use when creating and verifying tokens
:param str alg_id: the ID of the Algorithm
:raises KeyError: if algorithm is not registered.
pyjwt.utils
Python Library Documentation: module jwt.utils in jwt
NAME
jwt.utils
FUNCTIONS
base64url_decode(input: Union[bytes, str]) -> bytes
base64url_encode(input: bytes) -> bytes
bytes_from_int(val: int, *, bit_length: Optional[int] = None) -> bytes
bytes_to_number(string: bytes) -> int
decode_dss_signature(data)
der_to_raw_signature(der_sig: bytes, curve: 'EllipticCurve') -> bytes
encode_dss_signature(r, s)
force_bytes(value: Union[bytes, str]) -> bytes
from_base64url_uint(val: Union[bytes, str]) -> int
is_pem_format(key: bytes) -> bool
is_ssh_key(key: bytes) -> bool
number_to_bytes(num: int, num_bytes: int) -> bytes
raw_to_der_signature(raw_sig: bytes, curve: 'EllipticCurve') -> bytes
to_base64url_uint(val: int, *, bit_length: Optional[int] = None) -> bytes
DATA
Optional = typing.Optional
Optional[X] is equivalent to Union[X, None].
Union = typing.Union
Union type; Union[X, Y] means either X or Y.
On Python 3.10 and higher, the | operator
can also be used to denote unions;
X | Y means the same thing to the type checker as Union[X, Y].
To define a union, use e.g. Union[int, str]. Details:
- The arguments must be types and there must be at least one.
- None as an argument is a special case and is replaced by
type(None).
- Unions of unions are flattened, e.g.::
assert Union[Union[int, str], float] == Union[int, str, float]
- Unions of a single argument vanish, e.g.::
assert Union[int] == int # The constructor actually returns int
- Redundant arguments are skipped, e.g.::
assert Union[int, str, int] == Union[int, str]
- When comparing unions, the argument order is ignored, e.g.::
assert Union[int, str] == Union[str, int]
- You cannot subclass or instantiate a union.
- You can use Optional[X] as a shorthand for Union[X, None].
FILE
c:\users\youse\appdata\local\programs\python\python312\lib\site-packages\jwt\utils.py
pyjwt.warnings
Python Library Documentation: module jwt.warnings in jwt
NAME
jwt.warnings
CLASSES
builtins.DeprecationWarning(builtins.Warning)
RemovedInPyjwt3Warning
builtins.UserWarning(builtins.Warning)
InsecureKeyLengthWarning
class InsecureKeyLengthWarning(builtins.UserWarning)
| Warning emitted when a cryptographic key is shorter than the minimum
| recommended length. See :ref:`key-length-validation` for details.
|
| Method resolution order:
| InsecureKeyLengthWarning
| builtins.UserWarning
| builtins.Warning
| builtins.Exception
| builtins.BaseException
| builtins.object
|
| Data descriptors defined here:
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.UserWarning:
|
| __init__(self, /, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| ----------------------------------------------------------------------
| Static methods inherited from builtins.UserWarning:
|
| __new__(*args, **kwargs) class method of builtins.UserWarning
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.BaseException:
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __reduce__(...)
| Helper for pickle.
|
| __repr__(self, /)
| Return repr(self).
|
| __setstate__(...)
|
| __str__(self, /)
| Return str(self).
|
| add_note(...)
| Exception.add_note(note) --
| add a note to the exception
|
| with_traceback(...)
| Exception.with_traceback(tb) --
| set self.__traceback__ to tb and return self.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.BaseException:
|
| __cause__
| exception cause
|
| __context__
| exception context
|
| __dict__
|
| __suppress_context__
|
| __traceback__
|
| args
class RemovedInPyjwt3Warning(builtins.DeprecationWarning)
| Warning for features that will be removed in PyJWT 3.
|
| Method resolution order:
| RemovedInPyjwt3Warning
| builtins.DeprecationWarning
| builtins.Warning
| builtins.Exception
| builtins.BaseException
| builtins.object
|
| Data descriptors defined here:
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.DeprecationWarning:
|
| __init__(self, /, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| ----------------------------------------------------------------------
| Static methods inherited from builtins.DeprecationWarning:
|
| __new__(*args, **kwargs) class method of builtins.DeprecationWarning
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.BaseException:
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __reduce__(...)
| Helper for pickle.
|
| __repr__(self, /)
| Return repr(self).
|
| __setstate__(...)
|
| __str__(self, /)
| Return str(self).
|
| add_note(...)
| Exception.add_note(note) --
| add a note to the exception
|
| with_traceback(...)
| Exception.with_traceback(tb) --
| set self.__traceback__ to tb and return self.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.BaseException:
|
| __cause__
| exception cause
|
| __context__
| exception context
|
| __dict__
|
| __suppress_context__
|
| __traceback__
|
| args
FILE
c:\users\youse\appdata\local\programs\python\python312\lib\site-packages\jwt\warnings.py