问题
I have a problem that when dowloading a image from flickr.com,the python function urllib.urlretrieve()
always return an error
[Errno socket error] (10060, 'Operation timed out')
for example:
import urllib
url = "http://farm3.static.flickr.com/2659/4207030547_23e6000d29_o.gif"
urllib.urlretrieve(url,"C://tmp.gif")
I am Chinese,and I dont know if the "time out" has anything to do with the speed of the the internet in China.
Now it falied in downing the .gif! what should i do about this? THX~~~
Any suggestion is appreciated~~~
回答1:
I can't reproduce.
The exact same code downloaded the picture.
I'm using python 2.7
It has to do either with the server (at that time) or with your internet connection.
回答2:
Consider using the urllib2 library instead, which allows you to specify the timeout (in Python 2.6+).
来源:https://stackoverflow.com/questions/7749649/how-to-download-a-image-in-flickr-by-python-urllib-urlretrieve