1

I have a simple API GET method that returns list of IP's in terminal the implementation works fine and and I can use JWT token to get list of IP. However when I try the same using TRY-OUT button on Swagger documentation page it hangs for ever. enter image description here

Here is the implementation:

@url_api.route("/getallips")
@url_api.header('Authorization: Bearer', 'JWT TOKEN', required=True)
class IpList(Resource):

    @jwt_required
    def get(self):
        """
           this function handles request to provide all ip's.
        :return: List of registered ip address metadata mapped to url's.
        """
        return jsonify(get_all_publicIp())

Am I missing something :

Ciasto piekarz
  • 7,853
  • 18
  • 101
  • 197
  • i got here from the issue https://github.com/noirbizarre/flask-restplus/issues/398 ; in looking at the docs for `jwt_required`, it looks like you need to have `@jwt_required()`, could that be the issue? – James Tobin Apr 05 '18 at 16:10
  • Well, in my opening post I have posted code with `@jwt_required` .. – Ciasto piekarz Apr 05 '18 at 16:20
  • specifically including `()` not just @jwt_required ; see https://stackoverflow.com/questions/35572663/using-python-decorator-with-or-without-parentheses for a difference between the two – James Tobin Apr 05 '18 at 16:42
  • From the documentation here: https://flask-restplus.readthedocs.io/en/stable/swagger.html @api.header indicates a header in the response - the browser swagger interface is probably ganging waiting for it. The 'correct' method appears to be making it a param. – cbz May 20 '18 at 16:58

0 Answers0