Live data from Hacker News

Flask API – Browsable Web APIs for Flask

flaskapi.org

1–10 of 50 posts

Re: Flask API – Browsable Web APIs for Flask

#3
Token auth in flask is something I was going to work on soon. It should be straightforward to use a decorator to protect restricted pages. One thing I am absolutely not clear yet is how you keep the user logged if the token expires after x seconds. I mean, if the user is using the app, somehow the token expiring date should be constantly updated, right?

All this would be amazing coupled with angularjs…

Edit Oh, and I join the question: what about flask-restful?

Re: Flask API – Browsable Web APIs for Flask

#4
post #3

Token auth in flask is something I was going to work on soon. It should be straightforward to use a decorator to protect restricted pages. One thing I am absolutely not clear yet is how you keep the user logged if the token expires after x seconds. I mean, if the user is using the app, somehow the token expiring date should be constantly updated, right? All this would be amazing coupled with angularjs… Edit Oh, and I…

> It should be straightforward to use a decorator to protect restricted pages.

Authentication policies will use a similar style to the renderers and parsers (and all of REST framework). You'll be able to set them per-view with a decorator, or set them system-wide in the config. You'll also be able to support multiple authentication policies.

Re: Flask API – Browsable Web APIs for Flask

#5
post #2

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

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

Re: Flask API – Browsable Web APIs for Flask

#7
This looks like a great start, although at the moment it seems to be on-par feature-wise with flask-restful, which is also quite a nice project. I expect the biggest challenges will be integrating authentication and authorization like Django REST Framework has out-of-the-box - Flask has a dearth of packages in this area [1]

Keep it up OP, I'm interested to see how this progresses and I'll be following on github.

[1] flask-login and flask-principal come to mind, though they still require a writing a lot of code (especially flask-principal).

Re: Flask API – Browsable Web APIs for Flask

#9
Request to the authors: This project looks really cool, I can see myself using it soon. Please though be careful with your auth stuff, that is where things get tricky in terms of integrating other plugins and whatnot. I'm not sure how you'll go about it, but it will probably be awesome if you keep flexibility and plugability with the flask ecosystem in mind.

Re: Flask API – Browsable Web APIs for Flask

#10

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 implementation, or some of the general API style/separation of concerns that Flask API and Django REST framework both share.

The big win would be having more than one project sharing the same APIs for renderers, parsers, authentication, permissions and throttling policies - that way there'd be scope for writing at least some libraries that work cross-framework.

Post reply on HN