I am using urllib2 to (try) downloading a file from a website. A file can only be loaded after specifying some form fields. I can create a request and get a response without any problems, for example:
req = urllib2.Request(url, data, headers) response = urllib2.urlopen(req)
When I look at response headers like this print response.info()['Content-Disposition'] , I see the file there, i.e. it prints something like attachment;filename=myfile.txt
But how can I download the application? If I do response.read() , I just get a string containing the HTML page of the page at the URL. The fact is that the URL is not a file, it is a โattachmentโ web page, and I am trying to download this application from urllib2. I believe that the attachment is dynamically generated, so it is not just sitting on the server.
source share