python - Download image from URL that automatically creates download -


i have url when opened, initiate download, , closes page. need capture download (a png) python , save own directory. have tried usual urlib , urlib2 methods , tried mechanize it's not working.

the url automatically starting download , closing causing problems.

update: using nginx serve file x-accel-mapping header.

there's nothing particularly special x-accel-mapping header. perhaps page makes http request ajax, , uses x-accel-mapping reader value trigger download?

here's how i'd urllib2:

response = urllib2.urlopen(url_to_get_x_accel_mapping_header) download_url = response.headers['x-accel-mapping'] download_contents = urllib2.urlopen(download_url).read() 

Comments

Popular posts from this blog

css - Which browser returns the correct result for getBoundingClientRect of an SVG element? -

gcc - Calling fftR4() in c from assembly -

Function that returns a formatted array in VBA -