One note.  I also receive the same error when using this url:

s = jsonrpclib.ServerProxy("http://localhost:8000/pledgedrives/default/
service/",verbose=1)


On Dec 8, 9:07 am, johntynan <[email protected]> wrote:
> I have a question about testing web2py's jsonrpc service using the
> python interactive shell.
>
> In looking at the web2py pyjamas todo application as a starting point,
> and noticed the following code in the tests folder:
>
> import jsonrpclib
>
> s = jsonrpclib.ServerProxy("http://localhost:8000/todo/default/
> service",
>                           verbose=1)
> reply = s.getTasks()
> print reply
>
> I found that I needed to download Matt Harrison's jsonrpclib 
> fromhttp://lkcl.net/jsonrpclib.tgzand place the jsonrpclib.py file
> somewhere within my python path
>
> After that, I decorated a class in my web2py app with
> @service.jsonrpc:
>
> http://code.google.com/p/pledgedrivetracker/source/browse/pledgedrive...
>
> Then, I tried to connect to the web2py jsonrpc service from within the
> python shell using this script:
>
> >>> s = 
> >>> jsonrpclib.ServerProxy("http://localhost:8000/pledgedrives/default/call/",verbose=1)
> >>> reply = s.service_pledgedrive_pledges('1')
>
> Only I receive the following error:
>
> connect: (localhost, 8000)
> send: 'POST /pledgedrives/default/call/ HTTP/1.0\r\nHost: localhost:
> 8000\r\nUser-Agent: jsonlib.py/0.0.1 (by matt harrison)\r\nContent-
> Type: text/xml\r\nContent-Length: 67\r\n\r\n'
> send: '{"params": ["1"], "method": "service_pledgedrive_pledges",
> "id": 6}'
> reply: 'HTTP/1.1 400 BAD REQUEST\r\n'
> header: Set-Cookie:
> session_id_pledgedrives=127-0-0-1-1bb105e6-9359-4a9e-
> a776-6915963c26ed; Path=/
> header: Content-Length: 534
> header: Content-Type: text/html; charset=UTF-8
> header: Date: Tue, 08 Dec 2009 14:54:13 GMT
> header: Server: CherryPy/3.2.0beta WSGI Server
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
>   File "jsonrpclib.py", line 136, in __call__
>     return self.__send(self.__name, args)
>   File "jsonrpclib.py", line 382, in __request
>     verbose=self.__verbose
>   File "jsonrpclib.py", line 179, in request
>     response
> jsonrpclib.ProtocolError: <ProtocolError for localhost:8000/
> pledgedrives/default/call/: 400 BAD REQUEST>
>
> Is it possible to tell if I am using the wrong syntax when calling
> jsonrpclib.ServerProxy or else where in my script?

--

You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.


Reply via email to