From bb21f5f5bebf04188cb24a87f99566bb35612517 Mon Sep 17 00:00:00 2001 From: Laurent Ghigonis Date: Sun, 10 Mar 2013 00:48:28 +0100 Subject: dtube: print target name when not found --- dtube/dtube.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'dtube') diff --git a/dtube/dtube.py b/dtube/dtube.py index 30d4dc5..52b1c1e 100755 --- a/dtube/dtube.py +++ b/dtube/dtube.py @@ -64,7 +64,7 @@ class He: try: he = HeIPrange(match.group(1), verbose=verbose) except Exception, e: - if str(e) == "Target not found": + if str(e)[:16] == "Target not found": print e print "Trying to get closest range announcements" ip = HeIP(match.group(1).split('/')[0], verbose=verbose) @@ -128,8 +128,9 @@ class He: time.sleep(random.random() * 3) # Forced to be kind if self.verbose and self.html.from_cache: print "Response from cache" - if re.search(r'ERROR: .* Not Found', self.tree.xpath('//title')[0].text): - raise Exception("Target not found") + err = re.search(r'ERROR: (.*) Not Found', self.tree.xpath('//title')[0].text) + if err: + raise Exception("Target not found : %s" % err.group(1)) class HeAS(He): url_prefix = '/AS' -- cgit v1.2.3-59-g8ed1b