urlfetch to call protoRPC vs curl

66 views
Skip to first unread message

Patrice

unread,
Mar 9, 2012, 10:13:55 AM3/9/12
to google-prot...@googlegroups.com
Hi,

I get an http 500 error when calling my protoRPC service with urlfetch.fetch(), while it is ok with curl.

urlfetch.fetch(url='http://localhost:8096/PostService.post_note', payload={"text": "Hello guestbook!"}, method=urlfetch.POST, headers={"Content-Type": "application/json"})
==> http 500

curl -H 'content-type:application/json' -d '{"text": "Hello guestbook!"}' http://localhost:8096/PostService.post_note
==> ok

Thank you for any advice.

Rafe Kaplan

unread,
Mar 9, 2012, 7:03:04 PM3/9/12
to google-prot...@googlegroups.com
I think you are meaning to pass payload in as a string rather than a
dictionary. Try this:

payload=repr({"text": "Hello guestbook!"}), method=urlfetch.POST,
headers={"Content-Type": "application/json"})

When you get a 500 error when using ProtoRPC it is likely that there
was some internal implementation exception. It should appear in your
logs. That will make it easier for you to understand what happened.

--
 - Rafe Kaplan

Patrice

unread,
Mar 11, 2012, 10:05:43 AM3/11/12
to google-prot...@googlegroups.com
Thank you guys for your help. The payload has to bee a string indeed, not a dict.

Bye.
Reply all
Reply to author
Forward
0 new messages