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
1 answer

How to use api-key with jwt and flask restplus

I am using flask restplus to define my resources and jwt-extended for authentification but i couldn t figure out how to implement Api-keys to use with sagger UI I've tried to use : authorizations = { 'apikey': { 'type': 'apiKey', …
0
votes
0 answers

How to accept None for integer type field

I have an endpoint to update a company model, one of the fields is "post_box" that is an integer, this is an optional parameter that feaults to null. So far, so good. But, I need to be able to set this to null so that the user can remove any value…
0
votes
1 answer

Flask RESTPlus API Swagger doesn't show Authorize button

When documented using Swagger UI, Flask RestPlus API doesn't reveal Authorize button when Api instance is configured to use authorizations. Whether Api is configured at instantiation or later using init_app method, it makes no difference.…
protagora
  • 31
  • 1
  • 7
0
votes
1 answer

Flask swagger default model field value dynamic

I'm looking for a way to make Swagger documentation field offer current date to the user each time it gets loaded. Supplying value doesn't work as it stays static, obviously. Giving it a function also doesn't work since the view is rendered and kept…
protagora
  • 31
  • 1
  • 7
0
votes
0 answers

How can I return 2 server responses, one just after opening the URL and other one after executing the request in the URL using Restplus in flask?

My backend takes time to fetch the data but till then , I have to wait for it to respond. Instead what I want is to show a response and when the data in the backend is processed , the server displays it. I am trying to do this using RestPlus(flask)…
jack
  • 101
  • 1
  • 9
0
votes
0 answers

Flask: api errorhandler executed two times

I'm doing a Flask API project, and I have a problem with handle the AssertionError exception. So my program check if the length of a specified parameter and raises an AssertionError if the length exceeds the limit. The problem is that the…
Albert Lazaro de Lara
  • 2,540
  • 6
  • 26
  • 41
0
votes
2 answers

KeyError: 'view_class' in Flask-restplus. Routing not working

According to the official documentation page, routes are initiated this way. I have done the same thing with the code below but for some reason, I get a KeyError: 'view_class': from flask import Flask from flask_restplus import Resource, Api app =…
Mysterio
  • 2,878
  • 2
  • 15
  • 21
0
votes
1 answer

Python Swagger response becomes null (Flask, Flask_Restplus)

I am able to view response content in the terminal but in the swagger UI, it is showing up empty. Issue: To debug I tried to print the value from variable ret in the function json_response_from_dict(dict_) and it is showing me the value that I am…
anand_v.singh
  • 2,768
  • 1
  • 16
  • 35
0
votes
1 answer

Not able to get Authorization from incoming request, even we sending it through Postman

I am sending simple GET request to backend API, that is built in python. I tried to get the headers from incoming request but not able to get it. Here is how I am trying to get it from flask import request request.headers.get('Authorization') but…
Sanjay
  • 1,958
  • 2
  • 17
  • 25
0
votes
1 answer

Flask Restplus disable API Endpoint when condition does not meet

Can I know how to disable flask restplus endpoint? I am trying to do something like when a condition does not meet, the endpoint is disabled and cannot be accessed. Is there a way we can do this in flask restplus or custom code is required? I know…
Derek Lee
  • 475
  • 1
  • 6
  • 20
0
votes
1 answer

How to combine Flask-RESTPlus with Requests: HTTP for Humans?

I'm using Flask-RESTPlus to make an endpoint and using Requests: HTTP for Humans to scraping product details from one of e-commerce site. I have got the product details perfectly using Requests, but when I combine it with FLASK-RESTPlus, I'm facing…
Tri
  • 2,722
  • 5
  • 36
  • 65
0
votes
0 answers

Flask Api route works with resquests.post(json=dict)

I have a flask login route that is supposed to return an access token My Route looks like, auth_api = Api(auth_bp) parser = auth_api.parser() auth = auth_api.model('Auth', { 'email': fields.String(required=True, description='Email'), …
spitfiredd
  • 2,897
  • 5
  • 32
  • 75
0
votes
1 answer

Error 401 in Swagger UI for Flask Restplus API

I am building an API with flask_restplus and flask_httpauth for token based authentication. Everything is working nicely, except for one thing. In the Swagger UI, I get error 401 when I try to execute a search query. Adding "Bearer" to the…
PythonSherpa
  • 2,560
  • 3
  • 19
  • 40
0
votes
1 answer

FileStorage files seems empty after virus-scanning

I used flask and flask-restplus to generate an upload api endpoint for my application. All seems working fine, but files data received are empty and then the saved file is empty. Here is my code upload_parser =…
Renaud Michotte
  • 389
  • 4
  • 17
0
votes
1 answer

Skip default model validation in Flask Restplus

Because of project specificity I have to write my own model validator for Flask-restplus API app. Simply speaking - when validation error occurs, its format and status code (400) is not proper. It should return JSON object with messages in…
Mateusz Korycinski
  • 1,037
  • 3
  • 10
  • 24