diff options
author | Jon Bergli Heier <snakebite@jvnv.net> | 2013-09-25 20:12:50 +0200 |
---|---|---|
committer | Jon Bergli Heier <snakebite@jvnv.net> | 2013-09-25 20:12:50 +0200 |
commit | c73fe335108f00515a845fe52b06f2e244892907 (patch) | |
tree | fe52d569b4326ab8b554efa88635caecbdb8f169 /modules | |
parent | 306b2a11a59d47e161c36a9e976428f6e0519edc (diff) |
url_titles: Added timeout to urlopen.
Diffstat (limited to 'modules')
-rw-r--r-- | modules/url_titles.py | 4 |
1 files changed, 3 insertions, 1 deletions
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: |