From 93b098ab1165fe78c89522ce53edfbd5b4d41409 Mon Sep 17 00:00:00 2001 From: pictuga Date: Tue, 30 Apr 2013 19:54:32 +0200 Subject: [PATCH] Added http timeout. --- morss.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/morss.py b/morss.py index bda9945..121bcd9 100644 --- a/morss.py +++ b/morss.py @@ -23,6 +23,7 @@ from readability import readability SERVER = True MAX = 70 DELAY=10 +TIMEOUT = 2 ITEM_MAP = { 'link': (('{http://www.w3.org/2005/Atom}link', 'href'), '{}link'), @@ -242,7 +243,7 @@ def EncDownload(url): try: cj = CookieJar() opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj)) - con = opener.open(url) + con = opener.open(url, timeout=TIMEOUT) data = con.read() except (urllib2.HTTPError, urllib2.URLError) as error: log(error)