urllib2 might be fine. It looks like my server is sending a 301 redirect from the proper URL to the double encoded one.
I certainly don't do that anywhere in my code. Any idea why it would be doing that? import urllib, urllib2, httplib base_url='http://www.utilitymill.com/api/xml/utility/ get_Book_Data_by_ISBNs/13/run?' url=base_url + urllib.urlencode({'ISBNS':'9780596513986\r \n9780688128166','HTML':'1'}) opener = urllib2.build_opener(urllib2.HTTPHandler(debuglevel=1)) print opener.open(url).read() Gives: connect: (www.utilitymill.com, 80) send: 'GET /api/xml/utility/get_Book_Data_by_ISBNs/13/run? HTML=1&ISBNS=9780596513986%0D%0A9780688128166 HTTP/1.1\r\nAccept- Encoding: identity\r\nHost: www.utilitymill.com\r\nConnection: close\r \nUser-agent: Python-urllib/2.4\r\n\r\n' reply: 'HTTP/1.1 301 Moved Permanently\r\n' header: Date: Wed, 07 May 2008 17:42:50 GMT header: Server: Apache/2.2.3 (Ubuntu) PHP/5.2.1 mod_wsgi/1.1 Python/ 2.5.1c1 header: Location: http://utilitymill.com/api/xml/utility/get_Book_Data_by_ISBNs/13/run?HTML=1&ISBNS=9780596513986%250D%250A9780688128166 header: Content-Length: 330 header: Connection: close header: Content-Type: text/html; charset=iso-8859-1 connect: (utilitymill.com, 80) send: 'GET /api/xml/utility/get_Book_Data_by_ISBNs/13/run? HTML=1&ISBNS=9780596513986%250D%250A9780688128166 HTTP/1.1\r\nAccept- Encoding: identity\r\nHost: utilitymill.com\r\nConnection: close\r \nUser-agent: Python-urllib/2.4\r\n\r\n' reply: 'HTTP/1.1 200 OK\r\n' header: Date: Wed, 07 May 2008 17:42:50 GMT header: Server: Apache/2.2.3 (Ubuntu) PHP/5.2.1 mod_wsgi/1.1 Python/ 2.5.1c1 header: Connection: close header: Transfer-Encoding: chunked header: Content-Type: text/xml <?xml version="1.0" ?><UtilityMill><output><![CDATA[Content-Type: text/ HTML <html><body><dl> 9780596513986%0D%0A9780688128166 is not a valid value for ItemId. Please change this value and retry your request. </dl></body></html>]]></output></UtilityMill> --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "web.py" 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/webpy?hl=en -~----------~----~----~----~------~----~------~--~---
