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 marshmallow post_load? no attribute 'data'

From the docs under 'Deserializing to Objects': from marshmallow import Schema, fields, post_load class UserSchema(Schema): name = fields.Str() email = fields.Email() created_at = fields.DateTime() @post_load def…
Scott
  • 77
  • 1
  • 9
0
votes
1 answer

Recieving the error 'Expected bytes' when trying to update a DB entry

My API allows a user to update their user details by with a PUT request to the /User endpoint. However, when I try to send an update. It is failing when trying to save the password with the exception Expected Bytes. Below is my…
Keva161
  • 2,623
  • 9
  • 44
  • 68
0
votes
1 answer

Why Flask doesn't persists sessions with VueJS `npm run serve` frontend?

I have a simple application with Flask and Rest-Plus on backend and VueJS frontend generated by VueCLI 3. I am trying to set up sessions using Flask-Session but session variables saved in one request are not available in another. I have tried lots…
Fedoruka
  • 61
  • 5
0
votes
0 answers

Flask multiple optional url parameters in url separated by semicolon

I need accept the following url in my flask restplus app: .../app/u1=abc;u2=222;u3=xx;u4=jjj, all of them can be optional How I need to define my route? @api.route('/app/u1=;u2=;u3=;u4=')
0
votes
1 answer

Posting Nested models SQLAlchemy-Marshmallow

I am trying to wrap my head around SQLAlchemy in combination with Marshmallow. I had a Flask API that contains some Assets and Trading Pairs. I want bidirectional One-to-Many relationships between these models. I have the following code: class…
0
votes
2 answers

error value: Expecting value: line 1 column 1 (char 0)

I am getting error value:json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0). I have a app Flask. I want to use Rest api. I have a app.py file and api.py file.I am writing a get method in api.pyfile. This method have a input…
mina
  • 153
  • 6
  • 18
0
votes
0 answers

How to use Rest Api in app Flask for insert data to Database?

I have a app Flask. I want to use Rest api for insert data to Database. I have a app.pyfile and api.py file. I want to write a post method in api.py. I want to get information from client using add.html file and post it to api. then api this…
mina
  • 153
  • 6
  • 18
0
votes
3 answers

Need to execute a method 2 hour later after sending response in flask restplus

In eCommerce application, my requirement is, after placing the order send a notification(execute a method) to the seller after two hours. What is the best way to automatically execute the method after 2 hours.?
Mohammad Aarif
  • 1,619
  • 13
  • 19
0
votes
1 answer

Response class in Flask-RESTplus

What is the proper way to handle response classes in Flask-RESTplus? I am experimenting with a simple GET request seen below: i_throughput = api.model('Throughput', { 'date': fields.String, 'value': fields.String }) i_server =…
James Mak
  • 120
  • 1
  • 14
0
votes
0 answers

How can I re-use a model in multiple namespaces without redefining it?

Does the flask_restplus library allows to define a model once and re-use it in multiple namespaces. In my use case, I would like to have a general model for returning on successful post requests. At the moment, I have to redefine the model in every…
Molitoris
  • 935
  • 1
  • 9
  • 31
0
votes
1 answer

Flask_restPLUS + NGINX TypeError

I am developing an api using FLASK restPLUS + NGINX and with my intial route getting a type error: The view function did not return a valid response. The return type must be a string, dict, tuple, Response instance, or WSGI callable, but it was a…
Adam
  • 473
  • 5
  • 21
0
votes
1 answer

HTTP GET API Design which uses same endpoint but with provides filtered results with request parameters in Flask

I am using flask-restplus to create a RESTful API which connects to a MongoDB collection and provides information according to the API called. API Design HTTP GET api/hashdoc/ function: provides all a list of the relevant…
Shan-Desai
  • 3,101
  • 3
  • 46
  • 89
0
votes
3 answers

Python Flask Rest Plus - Return Response object along with description

I'm using Python Flask RestPlus framework, pretty new to Python. Trying to send back a response object along with some description and status code but failing with the following error: TypeError: Object of type Response is not JSON…
hakuna
  • 6,243
  • 10
  • 52
  • 77
0
votes
0 answers

Flask - How to handle errors that doesn't has a decorator for it?

I have some decorators to handle specific errors from my application like AuthError or AppError. Now I want to handle all other errors that are different from AuthError or AppError. Is possible to create a "generic" decorator that get other…
user866364
0
votes
1 answer

Dynamically generate Flask-RESTPlus routes

I am trying to abstract away some of the route class logic (i.e. I am looking to dynamically generate routes). api.add_resource seemed like the right place to do this. So this is what I am trying to do: # app.py from flask import Flask from…
country_dev
  • 605
  • 4
  • 13
  • 23