summaryrefslogtreecommitdiff
path: root/monitor/josef_experimental.py
diff options
context:
space:
mode:
authorjosef <josef.gson@gmail.com>2015-11-10 12:57:53 +0100
committerjosef <josef.gson@gmail.com>2015-11-10 12:57:53 +0100
commit99306083f68513cd04e3d1634ad7eb71b5733132 (patch)
tree2ce837e38fdc80ee6d62f0d224293ce72b5c596b /monitor/josef_experimental.py
parent6885ec5ce5c478cd7e607bbe283554eddb536158 (diff)
debugging
Diffstat (limited to 'monitor/josef_experimental.py')
-rwxr-xr-xmonitor/josef_experimental.py50
1 files changed, 25 insertions, 25 deletions
diff --git a/monitor/josef_experimental.py b/monitor/josef_experimental.py
index 2ccfceb..ba85a71 100755
--- a/monitor/josef_experimental.py
+++ b/monitor/josef_experimental.py
@@ -183,31 +183,31 @@ if __name__ == '__main__':
# Data gathering for Niklas
if True:
- log = CTLOGS[0]
- sth = get_sth(log["url"])
- # size = sth["tree_size"]
- # for i in range(15,200):
- start = 0
- end = int(sth["tree_size"]) - 1
- print "Getting " + str(start) + " to " + str(end)
- entries = get_entries(log["url"],start ,end)["entries"]
-
- # TODO set filename
- filename = log["name"] + "_content.txt"
- # TODO remove file if exists
- if os.path.exists(filename):
- if prompt_confirm("You are about to overwrite " + filename):
- os.remove(filename)
- else:
- sys.exit()
- # TODO open file
- with open(filename, 'a') as f:
- # TODO write lines
- for i in range(len(entries)):
- entry = entries[i]
- res = check_domain_extended(entry)
- string = parse_entry(res, i + start, log)
- f.write(string + "\n")
+ logs = [CTLOGS[7]]
+ for log in logs:
+ filename = log["name"] + "_content.txt"
+ if os.path.exists(filename):
+ if prompt_confirm("You are about to overwrite " + filename):
+ os.remove(filename)
+ else:
+ sys.exit()
+
+ sth = get_sth(log["url"])
+ start = 0
+ idx = 0
+ end = int(sth["tree_size"]) - 1
+
+ while idx < end:
+ entries = get_entries(log["url"],start + idx ,end)["entries"]
+ print log["name"] + ": Got " + str(start + idx) + " to " + str(start + idx + len(entries) - 1)
+ idx = idx + len(entries)
+
+ with open(filename, 'a') as f:
+ for i in range(len(entries)):
+ entry = entries[i]
+ res = check_domain_extended(entry)
+ string = parse_entry(res, i + start, log)
+ f.write(string + "\n")