Remove **kwargs from encode() and decode()
See original GitHub issueI recently had a situation where I was passing algorithm
instead of algorithms
to jwt.decode()
. Due to the **kwargs
eating the algorithm
parameter and the decode method looking at the encoded JWT to figure out what type of algorithm to use, everything appeared to be working the way you would expect, even though it wasn’t actually doing what I wanted it to.
If there wasn’t the **kwargs
there, my code would have raised a TypeError instead and immediately let me know I wasn’t using the API correctly. Personally, I think that is very desirable.
Would you be interested in a patch to remove **kwargs
and replace them all with named arguments instead?
Issue Analytics
- State:
- Created 6 years ago
- Reactions:4
- Comments:6 (2 by maintainers)
Top Results From Across the Web
Removing unusual characters, after decoding and encoding
You need to decode after the data is input, use it as unicode and encode it only for output. An UnicodeDecodeError is raised...
Read more >json — JSON encoder and decoder — Python 3.11.1 ...
Serialize obj as a JSON formatted stream to fp (a .write() -supporting file-like object) using this conversion table. If skipkeys is true (default: ......
Read more >Tokenizer - Hugging Face
When the tokenizer is loaded with from_pretrained(), this will be set to the value ... to False ) — Whether or not to...
Read more >Changelog — PyJWT 2.4.0 documentation - Read the Docs
Changed¶. Remove arbitrary kwargs. ... Fix from_jwk() for all algorithms #598 ... Use jwt.decode(encoded, key, options={"verify_signature": False}) instead.
Read more >URL Helpers — Werkzeug Documentation (2.2.x)
decode_query (*args, **kwargs)¶. Decodes the query part of the URL. Ths is a shortcut for calling url_decode() on the query argument.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
It looks like we don’t currently allow
**kwargs
onencode()
but I do think we should definitely remove the**kwargs
fromdecode()
.This may be a non-trivial change to make since we currently have several arguments such as
audience=
andissuer=
which are not currently explicitly enumerated in the function definitions fordecode()
.Give it a shot if you’d like. 👍
This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days