diff options
author | Marius Gedminas <marius@gedmin.as> | 2020-06-09 14:56:50 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-09 17:56:50 +0600 |
commit | 079849d17687fde8fcb545c76882766883aa0f7a (patch) | |
tree | 5e647f49b39bfdee784bb15549daf162fbeaf889 | |
parent | e6f7c09331101d319396333fed5bb65f4ef7d2d8 (diff) | |
download | pyjwt-079849d17687fde8fcb545c76882766883aa0f7a.tar.gz |
Emit warnings about user code, not pyjwt code (#494)
This assumes all direct calls to private methods (leading underscore in name)
are from pyjwt code, hence stacklevel=3 nor 2.
-rw-r--r-- | jwt/api_jws.py | 1 | ||||
-rw-r--r-- | jwt/api_jwt.py | 3 |
2 files changed, 4 insertions, 0 deletions
diff --git a/jwt/api_jws.py b/jwt/api_jws.py index ef6b453..ef5d7ec 100644 --- a/jwt/api_jws.py +++ b/jwt/api_jws.py @@ -147,6 +147,7 @@ class PyJWS: + 'value for the "algorithms" argument when calling decode(). ' + "This argument will be mandatory in a future version.", DeprecationWarning, + stacklevel=2, ) payload, signing_input, header, signature = self._load(jwt) diff --git a/jwt/api_jwt.py b/jwt/api_jwt.py index b41bfdf..4289b40 100644 --- a/jwt/api_jwt.py +++ b/jwt/api_jwt.py @@ -89,6 +89,7 @@ class PyJWT(PyJWS): + 'value for the "algorithms" argument when calling decode(). ' + "This argument will be mandatory in a future version.", DeprecationWarning, + stacklevel=2, ) payload, _, _, _ = self._load(jwt) @@ -125,6 +126,7 @@ class PyJWT(PyJWS): "The verify_expiration parameter is deprecated. " "Please use verify_exp in options instead.", DeprecationWarning, + stacklevel=3, ) verify_claims = { @@ -141,6 +143,7 @@ class PyJWT(PyJWS): "The {} parameter is deprecated. Please add {} to" " the require list in options instead".format(opt, opt_claim), DeprecationWarning, + stacklevel=3, ) if isinstance(leeway, timedelta): |