urllib2 POST problem

Lawrence D'Oliveiro ldo at geek-central.gen.new_zealand
Fri Sep 21 05:20:39 EDT 2007


In message <1190231918.779534.22810 at v29g2000prd.googlegroups.com>, darran
wrote:

> entry = "<request><notes>testing API</notes><hours>3.5</
> hours><project_id>65750</project_id><task_id>79702</
> task_id><spent_at>Thu, 13 Sep 2007</spent_at></request>"

...

> # this POST (same data as the above curl example) fails with an
> internal server error (500)
> req = urllib2.Request(url='http://subdomain.harvestapp.com/daily/add',
> data=entry)
> response = opener.open(req)
> print response.read()

Perhaps the value of "entry" needs to be URL-encoded?



More information about the Python-list mailing list