I will look at it later today or tomorrow. Thanks you!
On Jun 6, 9:12 pm, szabba <isza...@gmail.com> wrote: > I've just made a quick modification to the fetch function from > gluon.tools and felt it might be worth posting. > > http://wklej.to/rLuT- I've pasted the code online since I didn't > really have time for sending a proper patch (whatever would > that mean for web2py - BTW, some guide about it wouldn't > hurt). > > The main difference is that when not on GAE it uses httplib > instead of urllib2, so it can use any HTTP method (including > PUT and DELETE). > > It also lets you send data that is not urlencoded (some web > APIs are based on JSON or XML, so I thought such a feature > might come in handy. > > The first new feature is controlled by the method keyword > argument. If it's value is not specified it behaves like it did > before (POST if it sends data and GET otherwise). > > The second feature is controlled by the encode_data keyword > argument (which defaults to True). > > PS. I'm affraid I didn't implement redirection handling. I'll > get to it asap, but now it's 4 am in my timezone and I need > some sleep right now. > > PPS. Since HTTPConnection.request accepts file-like > objects as the requests body I think I should count that as > implementing three features. ;)