I need a little help getting a tar file to download from a website. The website is set up as a form where you pick the file you want and click submit and then the download windows opens up for you to pick the location.
I'm trying to do the same thing in code (so I don't have to manual pick each file). So far I have gotten python 2.5.2 to return a response but its in a socket._fileobject
and I'm now not sure how to convert that into a file on my computer.
Below is output of the python shell and the steps I have taken
Python 2.5.2 on win32
IDLE 1.2.2
>>> import urllib
>>> import urllib2
>>> url = 'http://website/getdata.php'
>>> values = {'data[]': 'filex.tar'}
>>> data = urllib.urlencode(values)
>>> req = urllib2.Request(url,data)
>>> response = urllib2.urlopen(req)
>>> response
addinfourl at 22250280 whose fp = <socket._fileobject object at 0x01534570
>>> response.fp
socket._fileobject object at 0x01534570