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
7
votes
1 answer

Swagger with Flask-Restplus, API and multiple Blueprints

I'm building a very complex microservice using Flask and Flask-Restplus. It will have many endpoints, thus I'm organizing each endpoint into a separate Blueprint. Currently, I'm struggling with the usage of Flask-Restplus and API using multiple…
dacoda
  • 157
  • 1
  • 2
  • 10
7
votes
1 answer

marshalling dictionary with variable keys in flask restful /plus

I am building an API using flask-restful. I am also using flask-resfulplus for generating swagger documentation. I want to return a dictionary of items where the key is going to vary depending on the item. My model looks like this: item =…
nick_v1
  • 1,654
  • 1
  • 18
  • 29
7
votes
1 answer

How to use Decorators with Flask-RESTPlus for each function call?

I have problems to apply a decorator to my Resource. The Api decorators parameter gets applied to each Resource-function or how do I have to understand the decorators parameter? My decorator gets only applied at the start up and not on each function…
swiesend
  • 1,051
  • 1
  • 13
  • 23
6
votes
2 answers

Adding auth decorators to flask restx

I have a Flask application using flask-restx and flask-login. I would like all routes by default to require login, and explicitly define public routes that require no authentication. I have started using decorators following the example given in…
mikelong
  • 3,694
  • 2
  • 35
  • 40
6
votes
2 answers

flask-restplus fields.Nested() with raw Dict (not model)

Spoiler alert: I posted my solution as an answer to this question I am using flastk-resptlus to create an API. I have to provide the data in a specific structure, which I have problems to get, see an example below: What I need to get is this…
Dovi
  • 833
  • 1
  • 10
  • 29
6
votes
2 answers

How do I POST multiple files using Flask-RESTPlus?

I want to be able to POST an array of files. I got it working with a single file, but it doesn't work when adding action="append" to the parser. When adding action, the swagger UI allows me to upload multiple files, but when printing the files…
Joey
  • 61
  • 1
  • 2
6
votes
1 answer

How do I load a file on initialization in a flask application

I have a big file, let's call it machine_learning_model.hdf5. I am loading it into my application every time a post request endpoint is hit. The pseudocode looks like this: def post(self): model = load_model('./machine_learning_model.hdf5') …
Embedded_Mugs
  • 2,132
  • 3
  • 21
  • 33
6
votes
0 answers

How to put auth around the documentation endpoint for swagger UI in flask-restplus?

I love flask restplus and swagger UI, the only thing that I haven't been able to figure out is how to put a custom auth decorator around the call to the documentation endpoint to prevent others from being able to see the documentation. I thought it…
John Allard
  • 3,564
  • 5
  • 23
  • 42
6
votes
2 answers

404 error when using Google App Engine with flask and flask-restplus

My main.py file in the root folder looks like below. app = Flask(__name__) def configure_app(app): app.config['SERVER_NAME'] = settings.FLASK_SERVER_NAME app.config['SWAGGER_UI_DOC_EXPANSION'] = settings.RESTPLUS_SWAGGER_UI_DOC_EXPANSION …
6
votes
0 answers

How to expect a plain text payload in flask-restplus?

In order to rewrite a basic Flask example with Flask-Restplus, I would like to create a POST with only a plain text body. The below example does what I want, but of course the documentation is not correct as I do not expect a mapping with fields,…
Gere
  • 12,075
  • 18
  • 62
  • 94
6
votes
1 answer

excel download with Flask-RestPlus?

How to implement an API endpoint to download excel file using Flask-RestPlus? Previously I had implemented similar function using Pyramid. However that method didn't work here. Here is the old code snippet: workBook = openpyxl.Workbook() fileName =…
Navin
  • 83
  • 3
6
votes
4 answers

Python Flask RestPlus Enum Type

Am using python 3.4. I have created an enum type as shown below: import enum class EnumGender(enum.Enum): blank = ' ' female = 'Female' male = 'Male' other = 'Other' my question is how do i assign it to flask-restplus field as the…
Ndurere David
  • 98
  • 1
  • 7
6
votes
0 answers

Rate Limiting Endpoints using flask-limiter

I know and love flask-limiter from older projects. Now I want to use it on my flask-restplus based project. My ultimate solution would enable me, to do rate limiting on a per method level. So different rates apply to a post than to a get method. But…
FEZ
  • 61
  • 4
5
votes
1 answer

error cannot import name 'cached_property' from 'werkzeug' when importing [ `from werkzeug.utils import cached_property` ]

On importing "from flask_restplus import Api, Resource" api getting cannot import name 'cached_property' from 'werkzeug' Python version : Python 3.7.2rc1 pip freeze output…
pratik
  • 733
  • 1
  • 8
  • 11
5
votes
1 answer

How to implement flask restplus authorizations

I am trying to setup authentication in flask-restplus application. I want to add authentication to all endpoints in the application but don't want to write decorator on each route. I am looking for apikey based authentication. The problem is, I am…
1
2
3
21 22