AttributeError: 'dict' object has no attribute '_jws'
See original GitHub issueAttributeError: ‘dict’ object has no attribute ‘_jws’
got this error :
File “E:\github\MyGits\TDA\rest_server_sql.py”, line 113, in login token = jwt.JWT.encode({‘public_id’ : user.public_id, ‘exp’ : datetime.datetime.utcnow() + datetime.timedelta(minutes=30)}, app.config[‘SECRET_KEY’]) File “E:\github\MyGits\TDA\venv_tda\lib\site-packages\jwt\jwt.py”, line 44, in encode return self._jws.encode(message, key, alg, optional_headers) AttributeError: ‘dict’ object has no attribute ‘_jws’
while generating token:
token = jwt.JWT.encode({'public_id' : user.public_id, 'exp' : datetime.datetime.utcnow() + datetime.timedelta(minutes=30)}, app.config['SECRET_KEY'])
Issue Analytics
- State:
- Created 5 years ago
- Comments:12 (6 by maintainers)
Top Results From Across the Web
FastAPI is returning AttributeError: 'dict' object has no attribute ...
The problem happens when you try to create the Response object. This object expects a string as input (infact it tries to call...
Read more >Scipy | AttributeError: 'dict' object has no attribute 'norm' - Reddit
Hello everyone! I'm trying to use scipy's stats.norm.pdf() to build a gaussian model of my data, but I'm getting the error above.
Read more >python tutorial: AttributeError: 'dict' object has no attribute 'value'
python tutorial: #codefix # python #python_tutorialAttributeError: ' dict ' object has no attribute 'value': In this video i have shared why ...
Read more >How to fix : dict object has no attribute iteritems - YouTube
dict object has no attribute iteritems it is Attribute error in Python caused by removal of iteritems methods in Python 3.x.
Read more >JWCrypto Documentation - Read the Docs
It fails for a JWK that has only a public key or is symmetric. Parameters as_dict(bool) – If set to True export as...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top 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
It’s a caller bug.
jwt.JWT.encode
is not a static method, you should instantiatejwt.JWT
class first and then callencode
method of that instance.@yosida95 anyway I fixe the problem by uninstalling using :
pip uninstall jwt==1.0.0
And then I uninstalled pyJWT using:
pip uninstall PyJWT
And then install it again:
pip install PyJWT
And my code:
Is working