5
URL = "http://localhost:3000/dumpData.html?language=python"
7
print "Getting NTop stats in Python format"
10
# NTop takes a while to build the stats
11
while not statsText.count("hostNumIpAddress"):
12
print "Attempt #" + str(attempt)
14
statsText = urllib.urlopen(URL).read()
16
"NTop timed out, is it active?"
17
assert statsText.count("ntopDict"), \
18
"ntopDict not in output"
19
assert attempt < 100, \
20
"Could not get stats from NTop"
22
# give it a little while
27
print "Problems interpreting the stats"
29
print "Found stats for the following hosts:"
30
for host in ntopDict.keys():