I'm trying to download an image, however it does seem to work. Is it being blocked by ddos protection?
Here is the code:
urllib.request.urlretrieve("http://archive.is/Xx9t3/scr.png", "test.png")
Basically download that image as "test.png." I'm using python3 hence the urllib.request before urlretrieve.
import urllib.request
Have that as well.
Any way I can download the image? thanks!
I'd advice you to use requests, basically the way you are trying to get the image is forbidden, check this:
This snippet was adapted from here
The magic behind this is how the resource is retrieved, with
requests
that part is thestream=True
line. Some servers are more restricted with this methods to pull some resources like media.For reasons that I cannot even imagine, the server requires a well known user agent. So you must pretend to use for example firefox and it will accept to send the image:
Rather stupid, but when a server admin goes mad, just be as stupid as he is...