tecladocode / flask-jwt-extended-section-lectures Goto Github PK
View Code? Open in Web Editor NEWCode and changes for each lecture of the Flask-JWT-Extended section
Code and changes for each lecture of the Flask-JWT-Extended section
error message - TypeError: wrapper() got an unexpected keyword argument 'name'
python version - 3.9.10
On adding the brackets, everything works fine.
Any suggestions or reasons for this issue is appreciated.
Hi Jose, I just completed your course and it's been really great! I'm having some bugs with postman, which I believe are related to the settings like Headers, Body, etc.
For instance, I'm getting this error for POST {{url}}/logout
:
Traceback (most recent call last):
File "/Users/wilsonchan/opt/anaconda3/envs/flask/lib/python3.9/site-packages/flask/app.py", line 2095, in __call__
return self.wsgi_app(environ, start_response)
File "/Users/wilsonchan/opt/anaconda3/envs/flask/lib/python3.9/site-packages/flask/app.py", line 2080, in wsgi_app
response = self.handle_exception(e)
File "/Users/wilsonchan/opt/anaconda3/envs/flask/lib/python3.9/site-packages/flask_restful/__init__.py", line 271, in error_router
return original_handler(e)
File "/Users/wilsonchan/opt/anaconda3/envs/flask/lib/python3.9/site-packages/flask/app.py", line 2077, in wsgi_app
response = self.full_dispatch_request()
File "/Users/wilsonchan/opt/anaconda3/envs/flask/lib/python3.9/site-packages/flask/app.py", line 1525, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/Users/wilsonchan/opt/anaconda3/envs/flask/lib/python3.9/site-packages/flask_restful/__init__.py", line 271, in error_router
return original_handler(e)
File "/Users/wilsonchan/opt/anaconda3/envs/flask/lib/python3.9/site-packages/flask/app.py", line 1523, in full_dispatch_request
rv = self.dispatch_request()
File "/Users/wilsonchan/opt/anaconda3/envs/flask/lib/python3.9/site-packages/flask/app.py", line 1509, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args)
File "/Users/wilsonchan/opt/anaconda3/envs/flask/lib/python3.9/site-packages/flask_restful/__init__.py", line 471, in wrapper
return self.make_response(data, code, headers=headers)
File "/Users/wilsonchan/opt/anaconda3/envs/flask/lib/python3.9/site-packages/flask_restful/__init__.py", line 500, in make_response
resp = self.representations[mediatype](data, *args, **kwargs)
File "/Users/wilsonchan/opt/anaconda3/envs/flask/lib/python3.9/site-packages/flask_restful/representations/json.py", line 21, in output_json
dumped = dumps(data, **settings) + "\n"
File "/Users/wilsonchan/opt/anaconda3/envs/flask/lib/python3.9/json/__init__.py", line 234, in dumps
return cls(
File "/Users/wilsonchan/opt/anaconda3/envs/flask/lib/python3.9/json/encoder.py", line 201, in encode
chunks = list(chunks)
File "/Users/wilsonchan/opt/anaconda3/envs/flask/lib/python3.9/json/encoder.py", line 438, in _iterencode
o = _default(o)
File "/Users/wilsonchan/opt/anaconda3/envs/flask/lib/python3.9/json/encoder.py", line 179, in default
raise TypeError(f'Object of type {o.__class__.__name__} '
And this error for POST {{url}}/refresh
:
Traceback (most recent call last):
File "/Users/wilsonchan/opt/anaconda3/envs/flask/lib/python3.9/site-packages/flask/app.py", line 2095, in __call__
return self.wsgi_app(environ, start_response)
File "/Users/wilsonchan/opt/anaconda3/envs/flask/lib/python3.9/site-packages/flask/app.py", line 2080, in wsgi_app
response = self.handle_exception(e)
File "/Users/wilsonchan/opt/anaconda3/envs/flask/lib/python3.9/site-packages/flask_restful/__init__.py", line 271, in error_router
return original_handler(e)
File "/Users/wilsonchan/opt/anaconda3/envs/flask/lib/python3.9/site-packages/flask/app.py", line 2077, in wsgi_app
response = self.full_dispatch_request()
File "/Users/wilsonchan/opt/anaconda3/envs/flask/lib/python3.9/site-packages/flask/app.py", line 1525, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/Users/wilsonchan/opt/anaconda3/envs/flask/lib/python3.9/site-packages/flask_restful/__init__.py", line 271, in error_router
return original_handler(e)
File "/Users/wilsonchan/opt/anaconda3/envs/flask/lib/python3.9/site-packages/flask/app.py", line 1523, in full_dispatch_request
rv = self.dispatch_request()
File "/Users/wilsonchan/opt/anaconda3/envs/flask/lib/python3.9/site-packages/flask/app.py", line 1509, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args)
File "/Users/wilsonchan/opt/anaconda3/envs/flask/lib/python3.9/site-packages/flask_restful/__init__.py", line 467, in wrapper
resp = resource(*args, **kwargs)
File "/Users/wilsonchan/opt/anaconda3/envs/flask/lib/python3.9/site-packages/flask/views.py", line 84, in view
return current_app.ensure_sync(self.dispatch_request)(*args, **kwargs)
File "/Users/wilsonchan/opt/anaconda3/envs/flask/lib/python3.9/site-packages/flask_restful/__init__.py", line 582, in dispatch_request
resp = meth(*args, **kwargs)
File "/Users/wilsonchan/opt/anaconda3/envs/flask/lib/python3.9/site-packages/flask_jwt_extended/view_decorators.py", line 153, in decorator
verify_jwt_in_request(optional, fresh, refresh, locations, verify_type)
File "/Users/wilsonchan/opt/anaconda3/envs/flask/lib/python3.9/site-packages/flask_jwt_extended/view_decorators.py", line 89, in verify_jwt_in_request
jwt_data, jwt_header, jwt_location = _decode_jwt_from_request(
File "/Users/wilsonchan/opt/anaconda3/envs/flask/lib/python3.9/site-packages/flask_jwt_extended/view_decorators.py", line 349, in _decode_jwt_from_request
verify_token_not_blocklisted(jwt_header, decoded_token)
File "/Users/wilsonchan/opt/anaconda3/envs/flask/lib/python3.9/site-packages/flask_jwt_extended/internal_utils.py", line 42, in verify_token_not_blocklisted
if jwt_manager._token_in_blocklist_callback(jwt_header, jwt_data):
TypeError: check_if_token_in_blacklist() takes 1 positional argument but 2 were given
And this error for GET {{url}}/item/chair
:
Traceback (most recent call last):
File "/Users/wilsonchan/opt/anaconda3/envs/flask/lib/python3.9/site-packages/flask/app.py", line 2095, in __call__
return self.wsgi_app(environ, start_response)
File "/Users/wilsonchan/opt/anaconda3/envs/flask/lib/python3.9/site-packages/flask/app.py", line 2080, in wsgi_app
response = self.handle_exception(e)
File "/Users/wilsonchan/opt/anaconda3/envs/flask/lib/python3.9/site-packages/flask_restful/__init__.py", line 271, in error_router
return original_handler(e)
File "/Users/wilsonchan/opt/anaconda3/envs/flask/lib/python3.9/site-packages/flask/app.py", line 2077, in wsgi_app
response = self.full_dispatch_request()
File "/Users/wilsonchan/opt/anaconda3/envs/flask/lib/python3.9/site-packages/flask/app.py", line 1525, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/Users/wilsonchan/opt/anaconda3/envs/flask/lib/python3.9/site-packages/flask_restful/__init__.py", line 271, in error_router
return original_handler(e)
File "/Users/wilsonchan/opt/anaconda3/envs/flask/lib/python3.9/site-packages/flask/app.py", line 1523, in full_dispatch_request
rv = self.dispatch_request()
File "/Users/wilsonchan/opt/anaconda3/envs/flask/lib/python3.9/site-packages/flask/app.py", line 1509, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args)
File "/Users/wilsonchan/opt/anaconda3/envs/flask/lib/python3.9/site-packages/flask_restful/__init__.py", line 467, in wrapper
resp = resource(*args, **kwargs)
File "/Users/wilsonchan/opt/anaconda3/envs/flask/lib/python3.9/site-packages/flask/views.py", line 84, in view
return current_app.ensure_sync(self.dispatch_request)(*args, **kwargs)
File "/Users/wilsonchan/opt/anaconda3/envs/flask/lib/python3.9/site-packages/flask_restful/__init__.py", line 582, in dispatch_request
resp = meth(*args, **kwargs)
TypeError: wrapper() got an unexpected keyword argument 'name'
For all 3 of these error messages, in the Headers, KEY is Authorization
and VALUE is Bearer {{jwt_refresh_token}}
POST {{url}}/register
and POST {{url}}/login
work as expected, but I haven't tried the other endpoints.
Following your endpoint configs in Postman was a bit difficult in this section of the course - is there a way I can import your configs to make sure the code works on my end?
Thank you for reading!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.