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
80
votes
2 answers

Flask-RESTful vs Flask-RESTplus

Other than the ability to automatically generate an interactive documentation for our API using Swagger UI, are there any real advantages of using Flask-RESTplus over Flask-RESTful?
masterforker
  • 2,099
  • 1
  • 19
  • 34
23
votes
5 answers

Flask app wont launch 'ImportError: cannot import name 'cached_property' from 'werkzeug' '

I've been working on a Flask app for a few weeks. I finished it today and went to deploy it... and now it won't launch. I haven't added or removed any code so assume something has changed in the deployment process? Anyway, here is the full error…
Keva161
  • 2,263
  • 9
  • 36
  • 61
18
votes
2 answers

Flask-RESTPlus - How to get query arguments?

I'm curious how I can take query arguments coming from the GET method in Flask-RESTPlus. I didn't managed to find an example in the documentation. I have previously used pure flask and the way I was doing it was by calling 'request.args.get()' from…
nikitz
  • 843
  • 1
  • 10
  • 29
12
votes
2 answers

Serving Flask-RESTPlus on https server

I am relatively new to python and I created a micro service using flask-resplus. Works fine on my computer and on the dev server served with http. I dont have control on where the microservice could be deployed. In these case it seems is behind a…
Mosd
  • 1,420
  • 18
  • 21
12
votes
1 answer

Python restplus API to upload and dowload files

With python flask_restplus what is correct way to have a post and get methods to get and push a file e.g. xlsx to the server ? Does the marshaling need to be used for this ? reference:…
user3313834
  • 5,701
  • 4
  • 40
  • 76
9
votes
2 answers

How to document the post body using flask-ReSTplus?

How to document the input body that is expected to be posted in the value field to appear so that the user knows what to post? the following data is used currently: { "customer_id": "", "service_id": "", "customer_name": "", "site_name": "", …
8
votes
1 answer

Python Flask automatically generated Swagger/OpenAPI 3.0

Im trying to generate swagger document for my existing Flask app, I tried with Flask-RESTPlus initially and found out the project is abundant now and checked at the forked project flask-restx https://github.com/python-restx/flask-restx but still i…
DonOfDen
  • 3,426
  • 9
  • 50
  • 98
8
votes
6 answers

How to document a flask-restplus response with list of strings

I am documenting my response models, and need to show the api returns list of string. ["user1","user2"] but the model requires a dictionary(json) format, as follow: ns.response(200,'Success', NS.model("my_get_model",[{ "name":…
user3375740
  • 195
  • 2
  • 8
8
votes
3 answers

"No spec provided" error when trying to deliver swagger.json over HTTPS

If I try to deliver the Swagger UI using Flask RestPlus over HTTPS, I see only the "No spec provided" error message at the root URL, and the full Swagger UI never loads. However, if I visit the API endpoints they return responses as…
ukosteopath
  • 343
  • 5
  • 14
8
votes
3 answers

flask - something more strict than @api.expect for input data?

In my flask-restplus API I'd like not only to check that input data, like in the following example resource_fields = api.model('Resource', { 'name': fields.String(default = 'string: name', required = True), 'state': fields.String(default =…
user1403546
  • 1,379
  • 1
  • 16
  • 32
7
votes
2 answers

swagger flask restplus, upload a file and take json input together

I am trying to upload a file and well as take an input from the user in json format using Swagger UI. I have written the below code for the same. upload_parser = api.parser() upload_parser.add_argument('file', location='files', …
7
votes
3 answers

How to indicate base url in Flask Restplus documentation

Could you please describe how to indicate the base URL in the documentation automatically generated by Flask Restplus? I am running the following code but nothing shows up in the swagger UI: from flask import Flask from flask_restplus import…
Alexis.Rolland
  • 4,378
  • 3
  • 32
  • 59
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,554
  • 15
  • 27
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
  • 871
  • 1
  • 11
  • 18
6
votes
3 answers

How to validate date type in POST payload with flask restplus?

Consider the following: from flask import Flask from flask_restplus import Api, Resource, fields app = Flask(__name__) api = Api(app) ns = api.namespace('ns') payload = api.model('Payload', { 'a_str': fields.String(required=True), …
mRcSchwering
  • 646
  • 4
  • 18
1
2 3
22 23