4 ms·
Why use this and not Flask-RESTful? How is the use case different? http://flask-restful.readthedocs.org/en/latest/ http://flask-restful.readthedocs.org/en/late
by glimcat 13y ago
Why use this and not Flask-RESTful? How is the use case different?
http://flask-restful.readthedocs.org/en/latest/ http://flask-restful.readthedocs.org/en/latest/
- tomchristie 13y agoThe most obvious feature difference is the browsable API. Flask API also shares the same architecture as the core of Django REST framework, which I think just has a really nice separation of concerns. Also the interface of `request.data` means is easy to transparently support both JSON and form requests, and the nice content negotiation on responses means it's easy to build services that power both an HTML front-end and an API from the same endpoints. Right now Flask RESTful is more mature of course, but I've got high hopes for this, and it's been super fun to build so far.
- pmdarrow 13y agoWe've been considering "porting" our app from Flask-RESTful to Django REST Framework because it is so well architected, tested, and has a large community around it. So I'm overjoyed to hear that you're bringing this awesomeness to the Flask world Tom!
- tomchristie 13y agoMost welcome! For anyone on this thread who's interested in contributing I'd suggest opening a ticket citing your interest, so that we've then go a place we can start the discussion from.
- rajbala 13y agoPerhaps an obvious question, but why do APIs need to be browsable?
- tomchristie 13y agoThey don't need too, but it sure-as-hell improves accessibility & usability.
- jvehent 13y agoIf you are still asking yourself that question, I strongly recommend you read this book: http://restfulwebapis.com/ http://restfulwebapis.com/
- rajbala 13y agoIt's a legitimate question. I understand why URLs need to be browsable. How does a browsable API work when it may need certain HTTP headers, request signatures, etc?
- steveklabnik 13y agoThat's in the contents of the book.
- mwhite 13y agoWhat about using Swagger[0] with flask-restful-swagger[1]? [0] https://helloreverb.com/developers/swagger https://helloreverb.com/developers/swagger [1] https://github.com/rantav/flask-restful-swagger https://github.com/rantav/flask-restful-swagger
- frio 13y agoThe only reason I still use Django is my deep-seated and abiding love for django-rest-framework. If you're bringing it to Flask, then that's the final bullet.
- pmdarrow 13y agoI can sort of comment on this since I've used Flask-RESTful and Django REST Framework where a lot of the Flask-API design is/will be borrowed from. I think the browsable API feature is great but it's not the killer feature for me. To me the killer feature is the well-designed serialization and validation architecture. In Flask-RESTful this seems half-baked - there is no notion of hyperlinked references or nested objects. At our company we ended up implementing our own serialization & validation layer which felt a lot like reinventing the wheel. My hope is that we can bring this same great architecture over from DRF to Flask-API.
- weixiyen 13y agoHonestly, Flask-Restful provides almost nothing useful that couldn't be added to an entire Flask project with a few lines of code. I've completely moved away from it as it actually introduced an obscure bug in content negotiation, while at the same time requiring extra mental overhead just to use.
- ciokan 13y agoeven better one http://python-eve.org/ http://python-eve.org/