rocket - updates after criticisms

From: Jms D.
Sent on: Monday, November 29, 2010 5:42 AM
Hey nycpython -

Hopefully you recall my module, Rocket, for making client-side web api's easy to implement.


Here is my original explanation of Rocket:?http://www.meetup.com/nycpython/messages/11169415/

I thought about some of the criticisms rocket received from nycpython and I've coded some solutions.

1) The first (and worst) criticism it received was that it was nasty to pass globals() between rocket and a module implementing an API.?

That was a great point (and nasty code) so I fixed that. A rocket instance simply handles all the code generation internally as part of it's __init__().

2) The http stuff and the type checking stuff are too coupled.

Also a good point. I have moved the code generation stuff into it's own module (rocket.proxies). This code knows nothing of HTTP, so it could be used for anything where an IDL is in use.?

Rocket still handles sending the requests out to HTTP, but I'm interested in making it more abstract if people have ideas. Perhaps a zmq handler in addition to http?

3) The code is confusing

Yes, it kind of is. I hope it's easier to understand now that it's broken out into rocket.py, auth.py, proxies.py and http_handling.py. Rocket's design is not trivial, but most of the trickiness lies in the handling of the proxies. You don't need to know anything about it's design to use rocket modules. Feel free to email me.

4) Examples

I now include sailthru, echonest, twilio, twitter and a simple module for people new to rocket. Each come with a README and a setup.py but only sailthru and echonest are feature-full. Twilio has enough code to send an SMS and Twitter has enough code to run a simple search.?

Twilio also shows how basic_auth can be used with Rocket.


Any criticisms would be welcome.

James

Sign up

Meetup members, Log in

By clicking "Sign up" or "Sign up using Facebook", you confirm that you accept our Terms of Service & Privacy Policy