From 665586433749dffbddbf7413f7bf61669e4d525c Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Tue, 1 Nov 2011 09:38:00 +0100 Subject: [PATCH] add timeout to getData --- ox/web/criterion.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ox/web/criterion.py b/ox/web/criterion.py index b026295..f1fbff3 100644 --- a/ox/web/criterion.py +++ b/ox/web/criterion.py @@ -15,7 +15,7 @@ def getId(url): def getUrl(id): return "http://www.criterion.com/films/%s" % id -def getData(id): +def getData(id, timeout=ox.cache.cache_timeout): ''' >>> getData('1333')['imdbId'] u'0060304' @@ -30,9 +30,9 @@ def getData(id): "url": getUrl(id) } try: - html = readUrlUnicode(data["url"]) + html = readUrlUnicode(data["url"], timeout=timeout) except: - html = ox.cache.readUrl(data["url"]) + html = ox.cache.readUrl(data["url"], timeout=timeout) data["number"] = findRe(html, "