1

I'm familiar with using urllib.urlretrieve to grab an image from online (such as explained here: https://stackoverflow.com/a/3042786/).

I want to grab a set of images with url's ending in /get.aspx?1234 (with varying numbered suffixes). I don't know exactly how aspx works, but I know that when I tried using urllib.urlretrieve to grab the images it didn't work. What other function can I use?

When I put the url ending in /get.aspx?1234 in my browser I just get an image that shows up where I can right click and save as a jpeg. When I click open image in new tab, I get the exact same url ending in /get.aspx?1234. I don't know what better url to use to identify this image.

Community
  • 1
  • 1
Oats
  • 13
  • 3

1 Answers1

0

Check headers you sent when you open the image in the browser. Server can check them somehow to prevent automatic downloads. So, basically, you need to keep same headers when you request the URL programatically.

Aleksandr
  • 2,185
  • 2
  • 21
  • 29
  • Sorry, I'm not sure how to check my headers in my browser or how to send different headers. Can you point me in the right direction? – Oats May 22 '15 at 03:58
  • Sure. Browser - http://stackoverflow.com/questions/4423061/view-http-headers-in-google-chrome – Aleksandr May 22 '15 at 03:59
  • Python - use the urllib2, please. urllib does not allow setting headers for the request. – Aleksandr May 22 '15 at 04:00