Wednesday, August 1, 2012

urllib2: HTTP Error 415: Unsupported Media Type: Google App Engine Python, XML

Guys i have problem with this following code,

import urllib2  url = 'http://192.0.0.1.1/GVSignOn/ExecutePortType?WSDL' data = '''     <?xml version="1.0" encoding="UTF-8"?>     <gv:SignOnReq xmlns:gv="http://abc.com/gv" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">     <gv:TerminalId>1</gv:TerminalId>     <gv:StoreCode>1234</gv:StoreCode>     <gv:TimeStamp>01-01-2011 01:01:00</gv:TimeStamp>     </gv:SignOnReq>      ''' req = urllib2.Request(url) req.add_header('Content-Type', 'application/xml; charset=utf-8') req.add_header('Content-Length', len(data)) response = urllib2.urlopen(req, data) ## Here it raising an error                                        ## 'HTTP Error 415: Unsupported Media Type' 

Note: m using here python2.5 & Google app engine sdk 1.6.1v

Please help me on this to get response back..

Best Regards..

Niks.

Source: http://stackoverflow.com/questions/11720188/urllib2-http-error-415-unsupported-media-type-google-app-engine-python-xml

cotto ncaa bowl games bowls herman cain harry potter and the half blood prince city of ember city of ember

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.