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

getting error 'function' object has no attribute 'as_view' while trying to run flask app

I started writing flask app after a long time more than a year, guess I have forgot something. This below code results in an error: from flask import Flask from flask import jsonify from flask_restplus import Resource, Api from home_iot.config…
Ciasto piekarz
  • 7,853
  • 18
  • 101
  • 197
0
votes
1 answer

Flask Restplus base URL changed to /api but didn't give json data

Hello I'm trying using Flask Restplus, I changed the Base URL from '/' to '/api'. When the base URL is '/' it give me the JSON data. After I changed the base URL to '/api' it didn't give me the data, only give me the Flask-restplus API page. This is…
flyingduck92
  • 1,449
  • 2
  • 23
  • 39
0
votes
1 answer

Flask restplus swagger "Model not registered"

I keep getting the following error whenever I try send a request. not registered The code can be found at…
Zerg Overmind
  • 955
  • 2
  • 14
  • 28
0
votes
1 answer

Flask RESTPlus swagger interface doesn't pass Authorisation header on to curl request

Running latest (and now old due to the switchover to flask REST-X) flask RESTPlus using the authorization functionality for the swagger interface with a Bearer token as follows: authorizations = { 'apikey': { 'type': 'apiKey', 'in':…
David Boshton
  • 2,555
  • 5
  • 30
  • 51
0
votes
1 answer

Flask restplus exception is not caught by api.errorhandler

I want to define custom error handling for a Flask-restful API The flask custom error(FlaskGenericException) is raised but is not handled by restplus errorhandler. it just throws a 500 Internal Server error. Not sure why the dict defined inside…
min2bro
  • 554
  • 2
  • 9
  • 19
0
votes
1 answer

flask restful: how do I pass python function as a parameter to trigger GET request?

in flask-restplus, I want to pass system call object: subprocess.call() to GET request to print out R session information on server endpoint. To do so, I think I need to add system call object to parser, which I hope api endpoint print out R session…
jyson
  • 245
  • 1
  • 8
  • 27
0
votes
1 answer

flask restful enforcing required typed parameters

I am using Flask==1.1.2 and flask-restplus==0.13.0 to create a rough and ready REST API. I am following the official documentation on how to specify if an argument is required, however, I can still access the URLS without the parameters, and no…
Homunculus Reticulli
  • 65,167
  • 81
  • 216
  • 341
0
votes
1 answer

how to Upload jpg file and save it in restplas flask api?

I use restplus flask api . I want to upload jpg file then rename and save to files location. then save its url. I searched and found this code on https://flask-restplus.readthedocs.io/en/stable/parsing.html#file-upload, but I dont understand…
mina
  • 153
  • 6
  • 18
0
votes
1 answer

How to host flask-restx swagger UI using nginx reverse proxy

I have tried multiple way to fix the reverse proxy, but not getting any luck. I followed the below url to fix the issue: https://github.com/noirbizarre/flask-restplus/issues/223 The nginx config is as follows: http { include …
saurau01
  • 29
  • 6
0
votes
1 answer

Flask-restful using nested fields to generate docs with nested response, getting TypeError: Object of type Nested is not JSON serializable

I am using flask-restx / flask-restplus, trying utilize the swagger documentation generation feature. I have this setup for my models. A = api.model( 'A', { "a1": fields.String(description=''), "a2":…
aaron
  • 537
  • 2
  • 6
  • 17
0
votes
1 answer

Flask RestPlus/RestX: how do I share API models between Namespaces?

I've got the following structure in my Flask-RestX application: api_models users permissions namespaces users permissions I've got a permission_model in api_models/permissions which I want to use in user_model in api_models/users.…
0
votes
0 answers

Python: Can't Import Module "flask-RESTPlus", when using Docker

I have implemented a small Flask application by using a Docker environment. This is my project structure: dockertest ├─ .vscode │ └─ settings.json ├─ compose_flask ├─ Dockerfile ├─ app.py ├─ docker-compose.yml └─ requirements.txt This…
Daad
  • 1
0
votes
1 answer

Allow null values in a field in flask-restx / flask-restplus

I am using flask-restx for building an API. My api model is like the following: myModel = api.model( 'myModel', { 'id' : fields.Integer(min=1, required=True), 'code' : fields.String(enum=["A", "B", "C"], required=False), …
thomask
  • 743
  • 7
  • 10
0
votes
1 answer

time calculation decorator with flask-restplus

I am writing a webapi using flask and flask-restplus. I have created a decorator to calculate the time to execute api call. import time class TimeCalculateDecorator: def __init__(self, func): self.function = func def…
Abhash786
  • 881
  • 2
  • 24
  • 53
0
votes
0 answers

Order parameters in Swagger with Python flask-restplus/x

I'm documenting my REST endpoints with Flask-restx (Python 2.7) and the parameters to the endpoints get really strange sorting in Swagger. Right now the required parameters are not always first in the list. Output in Swagger It seems to be a way to…