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/

334 questions
6
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
  • 137
  • 1
  • 9
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
1 answer

Flask-Restplus: how to model string or object?

In Flask-Restplus, I need to model an attribute value that maybe either a list of strings or a list of objects. That is it can look like this: { 'my_attribute': [ 'value1', 'value2' ] } or it can look like the…
adib
  • 7,718
  • 6
  • 46
  • 85
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
  • 2
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
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,384
  • 2
  • 30
  • 37
5
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
  • 2,544
  • 2
  • 16
  • 31
5
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,…
Gerenuk
  • 10,513
  • 16
  • 48
  • 83
5
votes
2 answers

Flask RestPlus inherit model doesn't work as expected

So I have this model in Flask RestPlus: NS = Namespace('parent') PARENT_MODEL = NS.model('parent', { 'parent-id': fields.String(readOnly=True, 'parent-name': fields.String(required=True) }) CHILD_MODEL = NS.inherit('child',…
4c74356b41
  • 59,484
  • 5
  • 63
  • 109
4
votes
1 answer

flask restful: how to document response body with fields.Dict()?

In flask-restplus, I want to model the response body which has nested list strucure, so whenever make api call, response body will be returned what I expected. In responce body, it has a nested structure, I don't know how to document that. Am I…
beyond_inifinity
  • 305
  • 5
  • 23
4
votes
2 answers

How to accept None for String type field when using Flask-RESTPlus

I am just starting develop with flask-restplus and I am not a native speaker, but I will try to describe my question as clear as I can. I know there is a fields module in flask that help us define and filter response data type, such as String,…
Roy Kuo
  • 43
  • 5
4
votes
1 answer

Extending Flask REST API with WebSockets

I am currently working on extending my existing REST API created using Flask-RESTPlus with WebSocket support. The idea is to create a Web Thing Model compliant Web Thing (Gateway). The "Things" in my use-case are dynamically added or removed. The…
Pieter Moens
  • 141
  • 1
  • 11
4
votes
1 answer

Adding multiple json fields in flask_restplus RequestParser

I want to expect a request where the request.json looks like: { "app_name": "app", "model_name": "model" } I created the following parser: parser = reqparse.RequestParser() parser.add_argument('app_name', location='json',…
nish
  • 6,230
  • 17
  • 60
  • 113
4
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
  • 698
  • 9
  • 21
1
2
3
22 23