Hello Daniel, getting back at this. Why use webclient for this instead of using gluon/contrib/simplejsonrpc.py? its seems to me it does not belong there.
On Monday, 17 December 2012 14:01:18 UTC-6, Daniel Gonzalez wrote: > > I have slightly modified the WebClient to support jsonrpc. I am not sure > everything is correctly covered, but it is suiting my needs. > > In case you are interested, you can see the changes here: > > https://github.com/gonvaled/web2py/tree/webclient_add_jsonrpc > > The biggest problem I had was > that opener.addheaders.append((key,str(value))) is not working as (I) > expected: the content-type is not rewritten: > > http://stackoverflow.com/questions/13920211/not-possible-to-set-content-type-to-application-json-using-urllib2 > > On Monday, December 17, 2012 6:38:30 PM UTC+1, Daniel Gonzalez wrote: >> >> Hi, >> >> I am trying to understand how to use the included WebClient to test a >> JSONRPC interface. One showstopper for me at the moment is that I see the >> following in WebClient.post: >> >> # time the POST request >> data = urllib.urlencode(data) >> t0 = time.time() >> self.response = opener.open(self.url,data) >> self.time = time.time()-t0 >> >> When doing JSONRPC accesses I do not want the data to be urlencoded. >> Actually, I will prepare the data with json.dump, and I want WebClient to >> POST it transparently (I guess this goes in the body of the POST request). >> Is this at all possible? Is there an example of WebClient usage >> for JSONRPC interfaces somewhere? >> >> Thanks, >> Daniel Gonzalez >> > --