There is a website that has a list of files that I want to download. To ease the process I tried to write a script to do it for me. (Even though I can select multiple option
The line:
req = urllib2.Request('webpage/list.php')
is requesting the original web page, but the form posts data to webpage/data.php
. Does this work better?
req = urllib2.Request('webpage/data.php')
You should look into using the 'requests' library: http://docs.python-requests.org/en/latest/
I believe this would be accomplished like this using the requests library:
data={'data[]':'downloadable_file1.tar'}
req = requests.post('webpage/data.php', data)
with open('file.data', 'wb') as file:
file.write(req.content)