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

Python Flask API : How to send back selective columns from the resultset of a sqlalchemy join

I'm trying to do a simple code snippet to print the result of a 3 tables join query. I'm using python/flask-restplus/sqlalchemy Here is my example: class Users(db.Model): id = db.Column(db.Integer, db.Sequence('users_id_seq'), primary_key=True) …
0
votes
1 answer

flask restplus marshall self reference

I have model Category, which can have parent Category(self reference), so I can make hierarchy of categories. from project import db class Category(db.Model): __tablename__ = "categories" id = db.Column(db.Integer, primary_key=True,…
0
votes
1 answer

How do I let my task-handler function accept a default POST request from GAE pushqueue

I am using python and flask rest_plus. I wrote a push task and pushed to a queue with GAE. By default the queue pushes the message of the task to the handler by a POST request. Is there a way I can make my task-handler function accept a POST request…
0
votes
1 answer

Validate json string against api.model

I want to post json along with image bytes. I'm using api.parser to specify expected parameters: upload_parser = api.parser() a=True upload_parser.add_argument('image', location='files', …
0
votes
1 answer

remove whitespace from JSON response by flask-restplus

How can you get rid of whitespace in the JSON response by flask-restplus routes? In a similar question, but for flask-restful instead of flask-restplus, the answer suggested setting the config option JSONIFY_PRETTYPRINT_REGULAR = False. This does…
Daniel Kats
  • 4,055
  • 10
  • 47
  • 88
0
votes
1 answer

Flask-Restful: can't parse args of json nested value

I've got the json { "message": { "foo": "foo", "bar": "bar" } } And parser: parser = reqparse.RequestParser(bundle_errors=True) parser.add_argument('foo', type=str, required=True) parser.add_argument('bar', type=str,…
Gary Ng
  • 383
  • 7
  • 14
0
votes
1 answer

Can't read from server. It may not have the appropriate access-control-origin settings | Google Cloud | Swagger

I am trying to deploy restful API on google cloud. The code is working fine on my local. However, after the successful deployment of my application on google cloud when I am hitting the project URL, I am getting the following error: Can't read…
0
votes
0 answers

How do we represent in swagger documentation how to pass jwt token to an endpoint?

On my Flask-restplus swagger documentation I have defined an endpoint that gets me list of public ip address, I have learned that I can define a model resource_fields = api.model('Resource', { 'name': fields.String, }) but I have also learned…
Ciasto piekarz
  • 6,378
  • 11
  • 59
  • 149
0
votes
1 answer

How can I log marshaled messages sent by Flask-Restplus

Consider following bare minimum example: from flask_restplus import Api, Resource, fields from .models import User ns = api.namespace('users', description='User related operations') user = api.model('User', { 'id':…
StefanE
  • 7,144
  • 9
  • 44
  • 72
0
votes
1 answer

flask_restplus' marshal_with returns response with null values

I am using flask_restplus to create a documented API. The marshal decorator controls what data actually gets rendered in your response, but I am having trouble rendering the data. I have the following code: kpis_model = api.model('kpis', { …
mateocam
  • 161
  • 1
  • 1
  • 10
0
votes
3 answers

is it possible to generate swagger metadata json automatically with flask-RESTplus?

I have created an api using the python library flask-Restplus and have it's associated swagger ui being exposed to e.g http://serverURL:80/api/v1/documentation. Is it possible to expose this documentation page as a json somehow? I know this is…
Geocoder
  • 21
  • 6
0
votes
1 answer

Flask-Restplus, changing content-type in swagger

I am using flask_restplus to generate swagger. I have to accept Content-Type: application/x-www-form-urlencoded on one of the POST endpoint. But the auto generated swagger document only shows applicatin/json. How can I change this behavior? Thanks.
Ravee
  • 11
  • 3
0
votes
1 answer

Flask-Restplus is not generating API documentation

Here are the relevant parts of app.py def init_api(): blueprint = Blueprint("api", __name__, url_prefix="/api/v1") api.init_app(blueprint) api.add_namespace(circuit_namespace) app.register_blueprint(blueprint) def init_api_auth(): …
conquester
  • 816
  • 1
  • 12
  • 35
0
votes
0 answers

File upload Error : FlaskRestful - Getting 400 for POST request

I am trying to upload a file through the post request in flask restfulplus I followed the example in this link Here is my code @ns.route('/upload/logo/') @ns.doc('Upload Logo') class UploadImage(Resource): @ns.param('picture', 'image file…
Tsubaki007
  • 47
  • 4
0
votes
0 answers

Flask Restplus : Sending DateTime as a parameter

@ns.param('startTime', 'The task identifier', type=datetime) def get(self): parser = reqparse.RequestParser() parser.add_argument('startTime', type = datetime) I want to send datetime as an argument for the GET request but it is giving me…
Tsubaki007
  • 47
  • 4