Skip to content
Advertisement

Tag: flask-restful

Python decorator – Check if user is admin

I am creating simple API using flask, and I want to check if user which is trying to access is admin. This is function which should decide if user is admin or not And this is endpoint I am getting this error I don’t know where is the problem, I did this according this documentation. Could someone help me how

flask_jwt_extended CSRF_Token in flask_restful

I’m only setting access token in cookies. But I found CSRF_token also in cookies. I don’t understand why it’s happening and how it’s happening. Look my code:- Setting access token. cookies When I am using @jwt_requiured((locations=[‘cookies’],fresh=True) it returning Missing CSRF token. Here, I need to pass CSRF token through header. Does anyone know what is happening here ? and What

Flask-RESTful custom routes other than GET,PUT,POST,DELETE

In Flask-RESTful we add an api route like the below so that GET /api/kitty –> to CuteKitty.get() method; like this for all HTTP verbs Lets say that I need to provide my api consumers with a cute api like How can i achive the above routing with api.add_resource Like wise how to add route like /api/kitty/<int:kitty_id>/habits –> CuteKitty.habits(kitty_id) Answer Flask-RESTful

Advertisement