urllib2 - safe way to download something

2008-11-14 Thread konstantin
Hi, I wonder if there is a safe way to download page with urllib2. I've constructed following method to catch all possible exceptions. def retrieve(url): user_agent = 'Mozilla/4.0 (compatible; MSIE 5.5; Windows NT)' headers = {'User-Agent':user_agent} request = urllib2.Request(url,

Re: urllib2 - safe way to download something

2008-11-14 Thread konstantin
I mean I don't want to catch all unexpected errors with empty except: :). -- http://mail.python.org/mailman/listinfo/python-list

Re: urllib2 - safe way to download something

2008-11-14 Thread Steven D'Aprano
On Fri, 14 Nov 2008 06:35:27 -0800, konstantin wrote: Hi, I wonder if there is a safe way to download page with urllib2. I've constructed following method to catch all possible exceptions. See here: http://niallohiggins.com/2008/04/05/python-and-poor-documentation-

Re: urllib2 - safe way to download something

2008-11-14 Thread konstantin
On 14 нояб, 18:12, Steven D'Aprano [EMAIL PROTECTED] cybersource.com.au wrote: On Fri, 14 Nov 2008 06:35:27 -0800, konstantin wrote: Hi, I wonder if there is a safe way to download page with urllib2. I've constructed following method to catch all possible exceptions. See here: