Code Monkey home page Code Monkey logo

flask-restx-boilerplate's Introduction

Hi there ๐Ÿ‘‹

I'm Zeth Leonardo, Most of my experience is in Full-Stack Development with a demonstrated history of contributing to FOSS projects with other people and experience in the industry.

Currently taking Bachelours of Science (HONS) Computing in the University of Bolton.


  • ๐Ÿ”ญ Iโ€™m currently working on Personal projects.
  • ๐ŸŒฑ Iโ€™m currently learning Flutter - Desktop/Mobile development.
  • ๐Ÿ‘ฏ Iโ€™m looking to collaborate on FLOSS projects.
  • ๐Ÿค” Iโ€™m looking for help with Algorithms and low level programming.
  • ๐Ÿ’ฌ Ask me about Web Development.

flask-restx-boilerplate's People

Contributors

amedal avatar dependabot[bot] avatar skohari avatar x1zeth2x avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

flask-restx-boilerplate's Issues

TypeError: wrapper() got an unexpected keyword argument 'username'

It looks like there's something wrong when trying to access the UserGet resource from Swagger doc page located at http://127.0.0.1:5000/api/.

When I remove the @jwt_required decorator from the get() method it works as expected and I receive the correct response but as soon as I let it there I get this traceback instead:

Traceback (most recent call last):
  File "/Users/alexandrugrajdeanu/Projects/baseapi/venv/lib/python3.8/site-packages/flask/app.py", line 2088, in __call__
    return self.wsgi_app(environ, start_response)
  File "/Users/alexandrugrajdeanu/Projects/baseapi/venv/lib/python3.8/site-packages/flask/app.py", line 2073, in wsgi_app
    response = self.handle_exception(e)
  File "/Users/alexandrugrajdeanu/Projects/baseapi/venv/lib/python3.8/site-packages/flask_restx/api.py", line 671, in error_router
    return original_handler(f)
  File "/Users/alexandrugrajdeanu/Projects/baseapi/venv/lib/python3.8/site-packages/flask_restx/api.py", line 672, in error_router
    return original_handler(e)
  File "/Users/alexandrugrajdeanu/Projects/baseapi/venv/lib/python3.8/site-packages/flask_cors/extension.py", line 165, in wrapped_function
    return cors_after_request(app.make_response(f(*args, **kwargs)))
  File "/Users/alexandrugrajdeanu/Projects/baseapi/venv/lib/python3.8/site-packages/flask_restx/api.py", line 669, in error_router
    return self.handle_error(e)
  File "/Users/alexandrugrajdeanu/Projects/baseapi/venv/lib/python3.8/site-packages/flask/app.py", line 2070, in wsgi_app
    response = self.full_dispatch_request()
  File "/Users/alexandrugrajdeanu/Projects/baseapi/venv/lib/python3.8/site-packages/flask/app.py", line 1515, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/Users/alexandrugrajdeanu/Projects/baseapi/venv/lib/python3.8/site-packages/flask_restx/api.py", line 671, in error_router
    return original_handler(f)
  File "/Users/alexandrugrajdeanu/Projects/baseapi/venv/lib/python3.8/site-packages/flask_restx/api.py", line 672, in error_router
    return original_handler(e)
  File "/Users/alexandrugrajdeanu/Projects/baseapi/venv/lib/python3.8/site-packages/flask_cors/extension.py", line 165, in wrapped_function
    return cors_after_request(app.make_response(f(*args, **kwargs)))
  File "/Users/alexandrugrajdeanu/Projects/baseapi/venv/lib/python3.8/site-packages/flask_restx/api.py", line 669, in error_router
    return self.handle_error(e)
  File "/Users/alexandrugrajdeanu/Projects/baseapi/venv/lib/python3.8/site-packages/flask/app.py", line 1513, in full_dispatch_request
    rv = self.dispatch_request()
  File "/Users/alexandrugrajdeanu/Projects/baseapi/venv/lib/python3.8/site-packages/flask/app.py", line 1499, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args)
  File "/Users/alexandrugrajdeanu/Projects/baseapi/venv/lib/python3.8/site-packages/flask_restx/api.py", line 403, in wrapper
    resp = resource(*args, **kwargs)
  File "/Users/alexandrugrajdeanu/Projects/baseapi/venv/lib/python3.8/site-packages/flask/views.py", line 83, in view
    return self.dispatch_request(*args, **kwargs)
  File "/Users/alexandrugrajdeanu/Projects/baseapi/venv/lib/python3.8/site-packages/flask_restx/resource.py", line 49, in dispatch_request
    resp = meth(*args, **kwargs)
TypeError: wrapper() got an unexpected keyword argument 'username'

The above traceback comes from controller.py:

# imports [...]


@api.route("/<string:username>")
class UserGet(Resource):
    @api.doc(
        "Get a specific user",
        responses={
            200: ("User data successfully sent", data_resp),
            404: "User not found!",
        },
    )
    @jwt_required
    def get(self, username):
        """ Get a specific user's data by their username """
        return UserService.get_user_data(username)

In order to reproduce this, you can follow the next steps:

  • register a user
  • login using the above user
  • try to access this user's data by making a request to /api/user/<user> via Swagger UI.

I suppose this is due to the JWT bearer not being sent along with the request. How can I add that as well in the swagger doc so I can paste it there as well?

Issue when running using flask run | python giya.app

  • OS : MacOs Catalina
  • python.ver: python3.9

I don't know what I'm doing wrong, but after I clone this repo, create a virtualenv and pip install -r requirement.txt, create .env file with the required content, when I try to run the app using flask run, I received Error: While importing 'giya', an ImportError was raised., end when I try to run it using python giya.py to check the exact import problem, there is nothing on the console and the app just close.

Running with flask run

Screenshot 2022-08-16 at 10 04 41

Running with python giya.py

Screenshot 2022-08-16 at 10 09 08

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.