Phil Dreizen

Flask-RESTful follow up

I mentioned looking in Flask-RESTful previously. It seems to be an abandoned project. A fork, Flask-RESTful is also abadoned. But a recent fork, Flask-RESTx does appear active.

A former developer of Flask-RESTful suggested some recommended alternatives in a github comment. Notably, MethodView as an alternative to Resource addresses one of the concerns I had regarding Flask.

In conclusion, I'll be sticking with Flask + libs instead of using Flask-RESTful.

tags: flask
Python Flask

I decided to learn flask for the purpose of implementing a RESTful API in Python. The two major choices seem to be Django and Flask. Flask is a lightweight option, which was more appealing to me for the flexibility that comes with that.

After doing the tutorial I do like it enough to try it out.

One thing I'm not liking from the tutorial is how a single function has to handle multiple methods (ie GET and POST), explicitly checking the request for which method is being used. It's hardly a deal-breaker.

I did briefly look at Flask-RESTful which addresses this by having each url map to a "resource" class which has methods that correspond to each HTTP method. So the class' "post()" method is mapped to a POST request. I think I prefer that, so I'll be looking at Flask-RESTful and its various forks (Flask-RESTplus, Flask-RESTx....and so on).

FYI: I'm currently most familiar with Java's Jersey framework for REST APIs.

BTW: Though Flask-RESTful's "resource" class is named the same as Jersey's "Resource" concept, I actually think vanilla Flask's Blueprint is closer.

tags: TIL, flask, python