From c73fe335108f00515a845fe52b06f2e244892907 Mon Sep 17 00:00:00 2001 From: Jon Bergli Heier Date: Wed, 25 Sep 2013 20:12:50 +0200 Subject: url_titles: Added timeout to urlopen. --- modules/url_titles.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'modules') diff --git a/modules/url_titles.py b/modules/url_titles.py index 966b71b..5c5ae1b 100644 --- a/modules/url_titles.py +++ b/modules/url_titles.py @@ -4,6 +4,8 @@ info = { 'description': 'Fetches the title tags off of URLs.', } +cfg_section = 'module/url_titles' + import re, urllib2, htmlentitydefs, gzip, cStringIO, time from PIL import ImageFile @@ -68,7 +70,7 @@ class Module: t = time.time() try: - u = urllib2.urlopen(url) + u = urllib2.urlopen(url, timeout = config.getfloat(cfg_section, 'timeout')) except: return if not 'content-type' in u.headers: -- cgit v1.2.3