Live data from Hacker News

Flask API – Browsable Web APIs for Flask

flaskapi.org

31–40 of 50 posts

Re: Flask API – Browsable Web APIs for Flask

#31
post #18
post #17

I spent last 3 months building AngularJS + Flask where the client talks to server only through REST. There were 3 options: 1. Bare Flask 2. Flask RESTful 3. Flask Restless I've spent quite some time investigating 2nd and 3rd options. Problems with 2nd: a) Didn't bring much to the table comparing to pure Flask. Extra abstraction and complexity that without much improvements b) Swallowing Flask exceptions c) Risk that…

> I spent last 3 months building AngularJS + Flask where the client talks to server only through REST. I've been wanting to do something like this for a certain time, so I have a few questions if you don't mind. How do you handle authentication? Tokens? Cookies? Is there a special "API key" for your web app?

> Is there a special "API key" for your web app?

And if there is, what's the point? Would the only reason to ever change that key be to force old clients to upgrade if the API changes?

Re: Flask API – Browsable Web APIs for Flask

#32
post #17

I spent last 3 months building AngularJS + Flask where the client talks to server only through REST. There were 3 options: 1. Bare Flask 2. Flask RESTful 3. Flask Restless I've spent quite some time investigating 2nd and 3rd options. Problems with 2nd: a) Didn't bring much to the table comparing to pure Flask. Extra abstraction and complexity that without much improvements b) Swallowing Flask exceptions c) Risk that…

You should check out eve ( http://python-eve.org ) - it's amazing for rapid prototyping (if the fact it requires Mongo isn't an issue). I'm building an AngularJS + REST server using Eve for the server. It has saved me so much time that I'm putting my dev effort mainly into a comprehensive test suite because there's so little dev work to do (btw - I'm not the author, it's just the fastest framework I've found for deve…

Quite an endorsement; I'll have to try to make the time to check that out properly. :)

Re: Flask API – Browsable Web APIs for Flask

#34
Can someone tell me the advantages of all of these extra extensions for Flask? I thought the point of Flask was to make the framework part extremely light-weight.

When I need a REST-ful API for a Flask app, I just build the routes needed and code it up myself. Why both adding a whole extra framework for something? Flask by itself is already capable of supporting REST-style requests, so what does this do again? How much of the example listed was ordinary Flask-webapp code and how much was this extension? Add an HTML view to a JSON object and form for making REST requests?

Between this and the User extension from last night, I must be missing something. Or maybe I'm just old.

Re: Flask API – Browsable Web APIs for Flask

#35
post #34

Can someone tell me the advantages of all of these extra extensions for Flask? I thought the point of Flask was to make the framework part extremely light-weight. When I need a REST-ful API for a Flask app, I just build the routes needed and code it up myself. Why both adding a whole extra framework for something? Flask by itself is already capable of supporting REST-style requests, so what does this do again? How mu…

Looks like this generates HTML-friendly documentation on your Flask routes automatically.

Re: Flask API – Browsable Web APIs for Flask

#36

Maybe you could contribute to Eve ( http://python-eve.org ) instead (which is awesome) and already includes some of the features on your roadmap.

Looks nice. I am considering factoring the core of both Flask API and Django REST framework out into a library that could be integrated with any Python web framework - But that's not going to happen right away, so probably not much use to you in the immediate future. Flask API is pretty simple tho - so there might be bits you can borrow from - perhaps the content negotiation implementation, browsable API implementati…

Like how django-social-auth turned into python-social-auth?

Framework agnostic libraries is one of the reasons Haskell has had me smitten for quite a while now

Re: Flask API – Browsable Web APIs for Flask

#37
post #2

Why use this and not Flask-RESTful? How is the use case different? http://flask-restful.readthedocs.org/en/latest/

Honestly, 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.

Re: Flask API – Browsable Web APIs for Flask

#38
post #17

I spent last 3 months building AngularJS + Flask where the client talks to server only through REST. There were 3 options: 1. Bare Flask 2. Flask RESTful 3. Flask Restless I've spent quite some time investigating 2nd and 3rd options. Problems with 2nd: a) Didn't bring much to the table comparing to pure Flask. Extra abstraction and complexity that without much improvements b) Swallowing Flask exceptions c) Risk that…

You should check out eve ( http://python-eve.org ) - it's amazing for rapid prototyping (if the fact it requires Mongo isn't an issue). I'm building an AngularJS + REST server using Eve for the server. It has saved me so much time that I'm putting my dev effort mainly into a comprehensive test suite because there's so little dev work to do (btw - I'm not the author, it's just the fastest framework I've found for deve…

RE: Eve requiring Mongo, according to slide s 57-61 at https://speakerdeck.com/nicola/eve-rest-api-for-humans Eve supports pluggable backends - is Mongo really needed?

Re: Flask API – Browsable Web APIs for Flask

#39
post #22

Earlier quoted context omitted.

The 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…

Perhaps an obvious question, but why do APIs need to be browsable?

If you are still asking yourself that question, I strongly recommend you read this book: http://restfulwebapis.com/

Re: Flask API – Browsable Web APIs for Flask

#40

Earlier quoted context omitted.

You should check out eve ( http://python-eve.org ) - it's amazing for rapid prototyping (if the fact it requires Mongo isn't an issue). I'm building an AngularJS + REST server using Eve for the server. It has saved me so much time that I'm putting my dev effort mainly into a comprehensive test suite because there's so little dev work to do (btw - I'm not the author, it's just the fastest framework I've found for deve…

RE: Eve requiring Mongo, according to slide s 57-61 at https://speakerdeck.com/nicola/eve-rest-api-for-humans Eve supports pluggable backends - is Mongo really needed?

I think the architecture supports pluggable backends, but AFAIK mongo is the best supported (and is the only one I know much about). There is a backend for elasticsearch (https://github.com/petrjasek/eve-elastic) but I've never used it and don't know how complete it is. From looking on github support for SQLAlchemy is slowly in the works.
Post reply on HN