Questions tagged [flask-restplus]

Flask-RESTPlus is an extension for Flask that adds support for quickly building REST APIs documented with Swagger

Flask-RestPlus provide syntaxic suger, helpers and automatically generated Swagger documentation on top of Flask-Restful. It provides a bunch of decorators and helpers to quickly build documented and maintainable APIs with Flask.

Website: https://flask-restplus.readthedocs.io/

330 questions
1
vote
2 answers

Flask RESTPlus API URL not found error when working with Blueprint and Namespaces - 404 not found error

I am working with my first flask-RESTplus application and running into issues. Here is how my project is structured: proj/ - endpoints/ - __init__.py - example1.py - example2.py - app.py This is what I have in my…
user2966197
  • 2,793
  • 10
  • 45
  • 77
1
vote
1 answer

Flask-RESTPlus: How to get result of query sqlite database in nested API model?

I'm writing an api with Flask-RESTPlus and want to use a sqlite database First my current code: API Models lightstate = api.model('LightState', { 'red': fields.Integer(description='red part of the rgb light'), 'green':…
Aterus
  • 451
  • 1
  • 8
  • 13
1
vote
2 answers

Python Flask_restplus flash_restx dynamic marshalling response

Is it possible to dynamicaly modify the marshalled response model (ie : change fields list, add mask, ...) ? ex : from flask_restplus import Resource, fields model = api.model('Model', { 'name': fields.String, 'address': fields.String, …
Nathalie
  • 625
  • 6
  • 19
1
vote
1 answer

Adding multiple endpoints into a Flask-RESTplus namespace from multiple files

I am working with Flask-Resplus API I want to create multiple endpoints into a single namespace. That is simple, but if I want to split the code to add endpoints into multiple files, getting issues there. Following is my app file: from…
1
vote
1 answer

Flask_restx @api.route return statement results in a TypeError

I have a problem I am not able to solve. I want to make use of http cookies in flask. This is the code from documentation: @app.route('/token/auth', methods=['POST']) def login(): username = request.json.get('username', None) password =…
Data Mastery
  • 1,555
  • 4
  • 18
  • 60
1
vote
1 answer

dynamic serializer resolving in flask rest plus based on serialized value in another field

Is there any option for dynamic serialization based on certain field? assume model like this: class Action(base): id = Column(Integer, primary_key=True) action_type = Column(Enum(SubscriptionActionType, inherit_schema=True), nullable=False) …
andilabs
  • 22,159
  • 14
  • 114
  • 151
1
vote
1 answer

how to serialize JSONB field with marshall in flask restplus?

having model sqlalchemy like this class Action(base): id = Column(Integer, primary_key=True) parameters = Column(JSONB) how can I define serialization of parameters using flask restplus api.Model marshall?
andilabs
  • 22,159
  • 14
  • 114
  • 151
1
vote
1 answer

Flask Docker app not serving API and no files found inside docker image

I have a flask app and would like to containerize it through docker. Normally I run the app using flask run and it serves the API at port 8888. However, when I try to run it using docker, the API doesnt start. I build the image using docker-compose…
arunmmanoharan
  • 2,535
  • 2
  • 29
  • 60
1
vote
1 answer

Python file runs using python command but not using Flask

I have a small application built using Flask and Flask-restx. I can run the app using python app.py and the flask server runs on port 8888. I try to run the file using set FLASK_APP=app.py and run using flask run which seems to run, but doesnt open…
arunmmanoharan
  • 2,535
  • 2
  • 29
  • 60
1
vote
1 answer

Flask-Restx(/Flask-Restplus) detect reload

my problem is the following: In my Flask-Restx-Application I created a Runner-Thread which runs asynchronously to the main-thread of the Flask-Application. Now when I do changes as usual the Debugger still shows * Detected change in 'XXXXX',…
Cedric
  • 408
  • 1
  • 4
  • 18
1
vote
1 answer

attribute error raised when tried to document flask restplus request bodywith?

I am trying to document my request body with Flask-restplus' api.model, and I have to provide the data in a specific structure. Here is the request body looks like: request body { "version": 0, "subject": "SUBJECT10", "organization":…
jyson
  • 245
  • 1
  • 8
  • 27
1
vote
0 answers

Flask-RESTplus Upload image with token authentication

I make simple Flask REST-API app. There are just two fields: upload_parser.add_argument('photo', location='files', type=FileStorage) upload_parser.add_argument('group', location='form', choices=[1,2,3], help='Bad value for group') Everything works…
1
vote
1 answer

Flask/Pymongo/Restplus - When using update(**data) I get "IndexError: list index out of range"

Flask==1.1.1 pymongo==3.10.1 flask-restplus==0.13.0 I'm attempting to PUT JSON to a URL and use update() but I'm running into an issue. In routes.py I have a simple API setup... @api.route('/api/content/') class UpdateContent(Resource): …
jyoseph
  • 5,435
  • 9
  • 45
  • 64
1
vote
1 answer

hosting flask_restplus Swagger UI on Herokuapp says "No API Definition provided."

I'm trying to host the Swagger UI of Flask Restplus on Heroku server. It builds successfully and when checked in the logs of the heroku, even there it says "Build succeeded". But the problem is when I check the actual hosting there's just a msg on…
Aman Singh
  • 1,111
  • 3
  • 17
  • 31
1
vote
1 answer

Flatting nested field to array in Flask API

I'm using flask_restplus to build an API. I have two models: model_barcode = api.model('Barcode', { 'code': fields.String, }) and model_product = api.model('Product', { 'id': fields.Integer, 'name': fields.String, …
datawookie
  • 1,607
  • 12
  • 20