Questions tagged [flask-restful]

Flask-RESTful provides an extension to Flask for building REST APIs. Flask-RESTful was initially developed as an internal project at Twilio, built to power their public and internal APIs.

Project repo is maintain on Github currently.
The latest document is here
Its pypi info can be find here

1619 questions
0
votes
1 answer

python - Flask-RESTful get 404 error?

I followed the official docs of flask-RESTful and I'm trying to implement the first hello world demo. At first, I put all the example code in a single file and every thing works fine. However, when I split the code in three separated files (trying…
jinglei
  • 3,269
  • 11
  • 27
  • 46
0
votes
1 answer

Flask SQLAlchemy select child object - return JSONB column

I have a class with a one-many relationship. I would like to return all the parent’s children in the relationship ; specifically I’d like to return all the JSONB objects in my children tables. These are my class: class Parent(db.Model): …
0
votes
1 answer

CORs request with flask api - Jquery POST request results in OPTIONs

I have a flask API to control an immersion heater device. https://github.com/timcknowles/anovapi_backend/blob/master/anova.py This is on my localhost server and it responds correctly to JQuery POST requests on the same domain e.g.…
TimK
  • 109
  • 1
  • 9
0
votes
1 answer

Using Python Flask-restful with mod-wsgi

I am trying to use mod-wsgi with Apache 2.2 I have the following directory structure: scheduling-algos -lib -common -config -config.json resources -Optimization.py optimization.wsgi optimization_app.py My optimization_app.py is the…
kosta
  • 4,302
  • 10
  • 50
  • 104
0
votes
1 answer

flask-RESTful : why do I get an AssertionError when parsing an argument with the wrong type?

I'm using flask-RESTful for the first time. In the docs it says : Using the reqparse module also gives you sane error messages for free. If an argument fails to pass validation, Flask-RESTful will respond with a 400 Bad Request and a response…
David V.
  • 5,708
  • 3
  • 27
  • 27
0
votes
1 answer

Mongoengine + MongoMock do not return data as expected

I am trying to test a response made by the controller. The response is different when I am running it through gunicorn vs a testFramework My server.py looks like the following: app = Flask(__name__, static_url_path='/pub') api = Api(app,…
Angel.King.47
  • 7,922
  • 14
  • 60
  • 85
0
votes
2 answers

Setting URLS for REST API using Flask

I have two files - app.py which contains the code for a REST API and another page index.html which displays some contents of the API using AngularJS. Currently, I have to open the index.html file from the browser to get it working (after the server…
punjabidon
  • 11
  • 3
0
votes
1 answer

"TypeError: 'NoneType' object is not callable" using flask

I am using flask_api to build a simple web application, however I get a TypeError. Here is my code: user.py: #!/usr/bin/env python from flask.ext.api import FlaskAPI from flask import request, url_for class User_operations(object): def…
Vishnu
  • 56
  • 1
  • 12
0
votes
1 answer

Flask uWSGI application structure and python3 imports

I have a basic flask-restful application with a structure that looks like this as recommended on the flask website. /application /application /config.py /__init__.py /wsgi.ini Slightly irrelevant, but config.py is generated…
Leon
  • 12,013
  • 5
  • 36
  • 59
0
votes
1 answer

sqlalchemy class object not iterable

i'm trying to retrieve question from my question table but i'm getting error that questions class object not iterable. the sample of code which is giving this error is def get(self): for quser in session.query(questions).all(): return…
Manish Kumar
  • 75
  • 2
  • 11
0
votes
0 answers

How to use jsonify on a query response?

Using flask-restful, and having a database which stores, related to places, the name, hour of visit, hour of exit, and date of visit, I have this query: query = conn.execute("select * from geo_example where init_hour='%d'"%hour_of_visit) How do…
Shoplifter20
  • 151
  • 2
  • 2
  • 12
0
votes
2 answers

flask restful and sqlalchemy error: "uname": "Missing required parameter in the JSON body"

parser = reqparse.RequestParser() parser.add_argument('uname', type = unicode, required = True, location= 'json') parser.add_argument('pword', type = unicode, required = True, location= 'json') parser.add_argument('fname', type = unicode,…
Manish Kumar
  • 75
  • 2
  • 11
0
votes
1 answer

Handling hierarchical URIs with Flask-RESTful

I want to have a RESTful api which looks like…
0
votes
0 answers

How to use Flask-Restless with a geographical database and connect it to an interface?

I have thoroughly searched and I already know what to do (it is in the title). But the question here is: How do I start? Are there any examples of this? I need to have a geographical database that is connected to a Flask-Restless API. How do I…
Shoplifter20
  • 151
  • 2
  • 2
  • 12
0
votes
1 answer

To implement a web socket feature with Flask-Restful (REST Api) on the server side

WORK DONE: I have implemented a REST API with Mongo DB (PyMongo driver) using Flask-Restful having one endpoint named “Users” consisting of GET, POST, PUT, DELETE My PUT method: def put(self, short_name ): coll = db.users user_info =…