configure urllib.urlretrieve timeout

Steve Holden steve at holdenweb.com
Sun Oct 7 08:07:45 EDT 2007


Abandoned wrote:
> Hi..
> I want to set 30 second urllib.urlretrieve timeout..
> Because if urllib.urlretrieve can't connect to page wait 1-2 hour...
> I download the images to my server with urlretrieve if you know the
> better way please help me.
> 
> I'm sorry my bad english..
> 
import socket
socket.setdefaulttimeout(30)

at the top of your program might help.

regards
  Steve
-- 
Steve Holden        +1 571 484 6266   +1 800 494 3119
Holden Web LLC/Ltd           http://www.holdenweb.com
Skype: holdenweb      http://del.icio.us/steve.holden

Sorry, the dog ate my .sigline so I couldn't cat it




More information about the Python-list mailing list