Python REST frameworks for App Engine?
Any pointers, advice on implementing a REST API on App Engine with Python? Using webapp
for the application itself.
What I currently know i开发者_Python百科s that I can:
hack up my own
webapp
handlers for handling REST-like URIs, but this seems to lose its elegance for larger amounts of resources. I mean, it's simple when it comes totemperature/atlanta
, but not so much* for even a rather simple/users/alice/address/work
(though do keep in mind that I'm not saying this after having implemented that, just after spending some time trying to design an appropriate handler, so my perception may be off).use the REST functionality provided by one of the bigger Python web frameworks out there. I have some unexplainable sympathy towards
web2py
, but, since it's not used for the project, bundling it with the application just to provide some REST functionality seems.. overkill?
(Huh, looks like I don't like any of these approaches. Tough.)
So here's me asking: what advice, preferably based on experience, would you have for me here? What are my options, is my view of them correct, did I miss something?
Thanks in advance.
I had a similar issue. Wanting to quickly get my DataStore exposed via REST to WebApps.
Found: AppEngine REST Server.
I have only used it lightly so far, but it certainly appears to be very useful with a small amount of work. And it does use webapp as you suggested.
ProtoRPC is bundled with the SDK, and it is robust and actively developed (however experimental). Although I think the source code itself is a little convoluted, the feature-set is pretty complete and it was made by someone with experience in creating this kind of library. It supports transmiting using JSON, ProtocolBuffer and URL-encoded formats.
Also, you can create APIs that work on the server side and client side -- it defines a 'message' protocol with implementations in Python and JavaScript. I used other "RESTful" Python libraries, but no other provided this consistency out of the box.
Here is the project page and here is the mailing list.
Edit: maybe their documentation is lacking some keywords, but just to be clear: one or the purposes of ProtoRPC is to provide a solid foundation to create REST services.
精彩评论