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

Basic Pipeline for Python Rest API to handle images

I'm trying to figure how to accept images via a rest api. If my api does something like this: def post(self): sent_file = next(request.files.values()) sent_file.seek(0) file_data = sent_file.stream.read() import boto from…
Rob
  • 3,333
  • 5
  • 28
  • 71
0
votes
1 answer

Flask RESTful api put error

I have a Post model as follows - class Post(db.Model): id = db.Column(db.Integer, primary_key=True, autoincrement=True) likes = db.Column(db.Integer) body = db.Column(db.Text) user_id = db.Column(db.Integer,…
utkbansal
  • 2,787
  • 2
  • 26
  • 47
0
votes
1 answer

Class instance has no attribute, error when calling a function in Flask

I am trying to call a function on button click using flask. Here is a snippet of my code to make my question clearer. class User: def __init__(self, username): self.username = username def find(self): user =…
ramez
  • 321
  • 3
  • 22
0
votes
1 answer

Flask API: How to clear database connection pool?

I have been wrestling with this issue for a few days now but can't seem to find any solution. I am trying to create a REST APIendpoint using Flask framework. The issue is that the API gives out correct results for some time and as some time passes…
90abyss
  • 7,037
  • 19
  • 63
  • 94
0
votes
0 answers

Flask Restful project structure

This is my current structure: ├── app │   ├── auth │   │   ├── __init__.py │   │   ├── models.py │   │   └── resources.py │   ├── __init__.py ├── app.db ├── config.py ├── env └── run.py Auth module should take care of all the token based…
J. Doe
  • 1
0
votes
1 answer

Flask show return data on request

I have some problems. I am new to python and flask. I am building an API that makes queries to a database, a separate application front end and back end. But problems have come to rescue the search result with the Flask. Example: The Following…
0
votes
2 answers

Flask-RESTful render_template cannot work

I am new to flask,and I try to use Flask-RESTful to make flask work in restful way. However, I cannot render the HTML, while I try to return render_template it returns the source code of the HTML, it is in this way Flask render template not…
poople
  • 165
  • 2
  • 7
0
votes
0 answers

Having trouble structuring my Flask-Restful App, what am I doing wrong?

So I'm trying to graduate from the single file application and organize my flask app for scalability. However, I can't even get past running the server... I tried duplicating exact stackoverflow questions that have had similar troubles before, but…
Peter Li
  • 309
  • 3
  • 11
0
votes
1 answer

Flask errors vs web service errors

I'm going through the RESTful web services chapter of the Flask web development book by Miguel Grinberg and he mentions that errors can be generated by Flask on its own or explicitly by the web service. For errors generated by Flask, he uses a…
Brosef
  • 2,945
  • 6
  • 34
  • 69
0
votes
0 answers

App engine app.yaml setting for admin users

I was wondering how you can configure your app to restrict certain endpoints to logged in users or even admin users. Here is my app.yaml handlers: - url: /favicon\.ico static_files: favicon.ico upload: favicon\.ico - url: .* script:…
user3354890
  • 367
  • 1
  • 3
  • 10
0
votes
1 answer

Python flask_restful arguments

I'm creating the server end of a test API using flask_restful that will capture a request coming into the API with a ID, and 3 parameters. If the Id does not exists, then it is created and populated with the 3 data arguments. The Asset is created,…
Dusty Boshoff
  • 1,016
  • 14
  • 39
0
votes
1 answer

Implementing API exception flask-restful

I am trying to catch the Exception which is raised when the url provided is a messy and wrong url and then return the error response as JSON. This is what i did to implement this logic. The exception is raised inside the Analysis class when the…
ajknzhol
  • 6,322
  • 13
  • 45
  • 72
0
votes
1 answer

How to add many to one relation of same model to Flask-Restful marshaller?

I have a Category model, which can have a children, who also a Category model: class Category(db.Model): id = db.Column(db.Integer, primary_key = True) name = db.Column(db.String(32), nullable=False) description =…
AKhimself
  • 165
  • 1
  • 11
0
votes
1 answer

TypeError: __init__() missing 1 required positional argument: 'id'

My intention is to get the int:id from url and store the data to self.user from init function. It works for the other functions except for init. Is there anything I need to add? or is it not possible? @api.resource('/api/users/',…
Keon Kim
  • 740
  • 3
  • 12
  • 27
0
votes
1 answer

is this approach to Flask routing reasonable?

I am making every path lead to index.html, since it is a single page app. I made a blueprint called mod and put all the restul api there using flask-restful @mod.route('/') @mod.route('/') def home(p=0): return…
Keon Kim
  • 740
  • 3
  • 12
  • 27
1 2 3
99
100