HTTP GET to iDigi data service did not get response correctly


I tried to fetch the data from my iDigi data service. Under ~/test there are two files: text.txt and TestData_20Jan2013_11_14_47.xml.

I was able to fetch the data using a web browser. But when I tried to do so using Python, it did not work.

Below is the python scripts that I used to do this job. But I did not get the files properly. Instead I got the following reposes. I got return code 200. But the returnmsg and getfile() did not seem correct. Did I do something wrong or miss something? Thanks.

-----------Python Scripts Below-------

    auth = base64.encodestring("%s:%s"%(USERNAME,PASSWORD))[:-1]	       
    host = ''
    webservice = httplib.HTTP(host,80)
    webservice.putrequest('GET', '/ws/data/~/test')   
    webservice.putheader("Authorization", "Basic %s"%auth)
    webservice.putheader("Content-type", "text/xml; charset=\"UTF-8\"")
    # get the reply to the request
    returncode, returnmsg, headers = webservice.getreply()
    # if successful, print out the contents of the XML file
    if returncode == 200:
        xml = webservice.getfile()
        print returncode
        print "

print returnmsg
print "
print headers

-------------returncode, returnmsg, headers -------------------------------



content-length: 492
set-cookie: JSESSIONID=A262CCA2B41BCA653F92BF68D1F82029; Path=/ws; Secure
set-cookie: BIGipServerPOOL-; path=/
expires: -1
server: Apache-Coyote/1.1
last-modified: Mon, 21 Jan 2013 16:50:48 GMT
pragma: no-cache
cache-control: no-store
date: Thu, 24 Jan 2013 14:27:20 GMT
cachecontrol: no-cache
content-type: application/xml

Status: 200 OK
Content-Type: text/html; charset=utf-8
Cache-Control: no-cache
Expires: Fri, 01 Jan 1990 00:00:00 GMT
Content-Length: 10189


Is there a reason you have this line commented out?


I tried running your code and when I uncommented that I got the actual contents of the file.


I got it work. I put print back to codes.

Actually I updated the iDigi URL to I was told that if I keep using, it can be redirected now. But it will not work at one point in the future.

Thank you, Chris.