aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLaurent Ghigonis <laurent@p1sec.com>2013-02-28 04:19:34 +0100
committerLaurent Ghigonis <laurent@p1sec.com>2013-02-28 04:19:34 +0100
commit5c9d104a30bde82cdc49b49e972ff4db4e0a7b9d (patch)
treee1a37c3114dd4860f4c84df3b1df268e4a336117
parentdtube: parse and show AS announces for IP ranges (diff)
downloadlaurent-tools-5c9d104a30bde82cdc49b49e972ff4db4e0a7b9d.tar.xz
laurent-tools-5c9d104a30bde82cdc49b49e972ff4db4e0a7b9d.zip
dtube: better error handling when target not found
-rwxr-xr-xdtube/dtube.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/dtube/dtube.py b/dtube/dtube.py
index 7261ef5..7cc7a5f 100755
--- a/dtube/dtube.py
+++ b/dtube/dtube.py
@@ -104,14 +104,14 @@ class He:
self.html = requests.get(url, headers=He.url_headers)
if self.verbose: print self.html.status_code
if not self.html.ok:
- if self.html.status_code == 404:
- raise Exception("Target not found")
self.html.raise_for_status()
self.tree = etree.HTML(self.html.content)
if not getattr(self.html, 'from_cache', False):
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")
class HeAS(He):
url_prefix = '/AS'