mnot’s python http api

Random evening http://del.icio.us/ browsing brought be across http://www.mnot.net/python/http/, which is awesome. I was having similar fun over the weekend utilizing python’s support for overriding the behavior of the dictionary-syntax with __{get,set,del}item__.

It’s a similar type of beauty as the constrained interface of HTTP … the power comes in some part because of the interface constraint…

In any case, his example makes it slightly unclear what the mapping is

web = Dict()

GET

getResp = web[’http://asynchronous.org/blog’]

PUT

web[’http://asynchronous.org/blog’] = newData

DELETE

del web[’http://asynchronous.org/blog’]

POST

postResp = web(’http://asynchronous.org/blog’, newResourceData )

Very cool.

Update: More from the source.

Comments are closed.