From 9899cf89a195e997e4662d58e4b86e7ed44f91ea Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Sun, 24 Jan 2010 10:25:41 +0530 Subject: [PATCH] add timeout to imdb.guess --- oxweb/imdb.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/oxweb/imdb.py b/oxweb/imdb.py index d46f6b8..f714936 100644 --- a/oxweb/imdb.py +++ b/oxweb/imdb.py @@ -673,7 +673,7 @@ class IMDb: return self.credits -def guess(title, director=''): +def guess(title, director='', timeout=google.DEFAULT_TIMEOUT): #FIXME: proper file -> title title = title.split('-')[0] title = title.split('(')[0] @@ -688,7 +688,7 @@ def guess(title, director=''): search = 'site:imdb.com %s "%s"' % (director, title) else: search = 'site:imdb.com "%s"' % title - for (name, url, desc) in google.find(search, 2): + for (name, url, desc) in google.find(search, 2, timeout=timeout): if url.startswith('http://www.imdb.com/title/tt'): return normalizeImdbId(int(oxlib.intValue(url)))