Questions tagged [flask-restx]

Flask-RESTX is an extension for Flask that adds support for quickly building REST APIs in Python. Flask-RESTX is a community-driven fork of Flask-RESTPlus, hence users can also make use of [flask-restplus] tag in addition to [flask-restx] to search for relevant issues and questions.

Flask-RESTX is an extension for Flask that adds support for quickly building REST APIs.

Flask-RESTX encourages best practices with minimal setup. If you are familiar with Flask, Flask-RESTX should be easy to pick up.

It provides a coherent collection of decorators and tools to describe your API and expose its documentation properly using Swagger.

Flask-RESTX is a community driven fork of Flask-RESTPlus


A Minimal API

A minimal Flask-RESTX API looks like this:

from flask import Flask
from flask_restx import Resource, Api

app = Flask(__name__)
api = Api(app)

@api.route('/hello')
class HelloWorld(Resource):
    def get(self):
        return {'hello': 'world'}

if __name__ == '__main__':
    app.run(debug=True)

Compatibility

Flask-RESTX requires Python 2.7 or 3.4+.

Documentation

The documentation is hosted on Read the Docs

108 questions
-1
votes
1 answer

Flask-restx method not hitting if statement when using buffers to send data

When the DB is empty it should hit the first if condition and just return the error but for some reason, it executes the rest. Even when I comment out all the code after the if statement it executes all the code and returns an ICS file. Somehow the…
-1
votes
1 answer

Flask redirects POST requests automatically to GET requests but only in the cloud

I've built a Flask API using Flask RESTX. I've run it locally in a container and it's working as expected. My endpoints are expecting POST requests: class MyAPIEndpoint(Resource): def post(self): return "hello" Quite simple. When I run…
Standard
  • 1,450
  • 17
  • 35
-1
votes
1 answer

Flask make_server always raises "OSError: [Errno 98] Address already in use"

I am trying to write unit tests for some Python code I am working on, and some of this code contacts an API when it is done. I am trying to have a simple Flask API running to mock this API and check that the code sends the correct info. Here is the…
Gaëtan
  • 779
  • 1
  • 8
  • 26
1 2 3 4 5 6 7
8