Hi All, I am facing problem reading response from urllib2 request. i.e. with read() method.
I am trying to access XMLAPI using python. I am getting weird behavior from server, when reading response.Code for calling XMLAPI is as follows: headers = {'Content-type': 'application/x-www-form-urlencoded'} request = urllib2.Request(siteXMLAPIURL,xmlStr,headers) response = urllib2.urlopen(request) print response.read() In above code: xmlStr: is String containing XML request siteXMLAPIURL: URL of the site to send request. It is in form " https://xxx.xxx.com/XXXService/XXXService Problem Description: I am calling URL for creating product by passing methodname(CreateProduct), productId, productCreateDate, productCreateTime etc in XML form. Call to XMLAPI always succeed and product is created on site. But when I call .read() method to print response, then "productCreateTimes" gets changed on server !! For example, Case 1: Not using .read() method. (i.e. commenting print line in above code) Calling API by passing productCreateTime = 08/02/10 08:00:00,and then product is being created with time 08/02/10 08:00:00. i.e. everything is fine here Now, Case 2: Using read() method (i.e. having print line is code) Calling API by passing productCreateTime = 08/02/10 08:00:00 and then product is being created with time 08/02/10 09:00:00. Here, server is adding one more hour to productCrateTime. Which is really strange for me!! FYI: If I access same API with java, everything is fine all time. I am unable to understand why read() method is changing server behavior!! Can anyone please guide me in same? Thank you so much for your time. Waiting for your reply. Thanks, Hiral
-- http://mail.python.org/mailman/listinfo/python-list