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

Keras model is stuck at prediction level when running the server with gunicorn

I am using keras model to predict something and used flask-restplus to make this as a REST service. so far everything is working fine when I run the server with python app.py command. But I wanted to run this through gunicorn and nginx (gunicorn -b…
Reddi Mohan
  • 251
  • 2
  • 13
4
votes
1 answer

Validate custom field with Flask-RESTPlus

I'm trying to create a custom field for validating POSTed JSON in my API using Flask-RESTPlus 0.10.1 Below is the basic setup... from flask_restplus import fields import re EMAIL_REGEX = re.compile(r'\S+@\S+\.\S+') class Email(fields.String): …
aesterisk_
  • 329
  • 4
  • 15
4
votes
1 answer

How to display schema example with flask_restplus?

[Using Python, Flask, flask_restplus, Swagger] I'm trying to display a schema model as the picture below using flask_restplus. Prototype schema in yml and not python: I created the schema_model but I'm not sure how to input it into the code so that…
zeusking123
  • 189
  • 1
  • 10
4
votes
1 answer

flask restplus path variable default value

How to set the default value for a path variable with Flask restplus? For example, with the below: @api.route('/calendars/coordinates///years/') class DailyCalendarHandler(Resource): get_parser =…
vishvAs vAsuki
  • 2,421
  • 2
  • 18
  • 19
4
votes
1 answer

Take JSONAPI schema from model

In my Rest application I want to return json like JSONAPI format, but I need to create Schema class for it and create every field again that are already there in my model. So instead of creating every field in schema class can I not take it from DB…
Sanjay
  • 1,958
  • 2
  • 17
  • 25
4
votes
1 answer

Flask-restplus: how to define a nested model with 'allOf' operation?

Creating a python flask rest plus server application, I'm trying to create a model for input body (in POST operation) with 'allOf' operator, which is equivalent to the following example, taken from swagger.yaml I've created with the swagger…
Amir
  • 391
  • 2
  • 3
  • 10
4
votes
3 answers

Move Flask-Restplus Swagger API Docs

I'm trying to use flask-restplus to build a restful API in python. I'd like to have the swagger docs located in a different place than the normal "/". I'm following the documentation here and have followed the instructions. I'm using python2.7.3 and…
loganasherjones
  • 1,012
  • 2
  • 11
  • 19
3
votes
1 answer

How to set username and password for basic auth in flask restx swagger?

Im trying to add basic Authorization to my flask rest-x application. By referring to https://github.com/python-restx/flask-restx/issues/271 I have made code changes. But here there is no clarity on how to set and a username and password. As well in…
3
votes
0 answers

Flask Restplus using the api.doc decorator in the Namespace

The following code works: @api.route('/properties') @api.doc(security='Basic Auth') class CameraProperties(Resource): def get(self): return Utils.convertToDictionary(Camera().camera) @api.doc(body=camera_fields) def put(self): reqData…
codewrite
  • 111
  • 5
3
votes
1 answer

Get list of lists from query parameters using flask_restx RequestParser

I am creating Python server using Flask and Flask-RESTX modules. I would like to define route e. g. for this URL: /users?sort=age,asc&sort=name,desc So when I read sort query parameter, I will have list of pairs, where each pair is (property,…
Michal
  • 1,755
  • 3
  • 21
  • 53
3
votes
0 answers

flask-restplus POST marshall input model that is different from response model

I am building an api with flask_restplus. How the user gets/gives the data, is different of how is defined in my Models. This was easily solved with response marshalling…
Dovi
  • 833
  • 1
  • 10
  • 29
3
votes
0 answers

Gunicorn overrides Flask Restplus Error Handler

def create_app(): """Application factory, used to create application """ config = appconfig.AppConfig # Init connection for elastic search connections.create_connection( hosts=[config.ELASTIC_SEARCH_URI], timeout=20) …
Michael Royf
  • 127
  • 6
3
votes
1 answer

How to secure Flask-RESTPlus API with oAuth2?

My question is similar to this question. My goal is the same, but the answer given there uses a library that appears to have been superseded by Authlib. Does Authlib expose a similar decorator I could import? Can anyone link me to a solution or…
Phoenix911
  • 31
  • 1
3
votes
1 answer

problems running python Flask Restplus API on GCP (app engine)

I'm working on a API Rest app that has to work on GCP. The app runs great locally but when I deploy it to GPC it's not working. I wrote the webservice in Python 3.7, using Flask, SQLAlchemy, Flask-SQLAlchemy, Flask-Restplus (in order to have…
3
votes
2 answers

flask run does not work when using flask restplus

I am new to python and flask. I want to use flask-restplus. On using flask restplus, I am unable to start my app with "flask run" command. However, it does start when I run it as module "python3 -m flask run". My first question is there any…
Rajat Arora
  • 582
  • 1
  • 6
  • 18