-
Notifications
You must be signed in to change notification settings - Fork 0
/
fetch_res_pbid.py
38 lines (33 loc) · 956 Bytes
/
fetch_res_pbid.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#fetch the measurement results of ids stored in a txt file
import atlasTools as at
import os
import sys
import time
import calendar
import math
from globalConfig import *
def main():
pbs=[]
f = open(PROBE_ID_ALL_FILE, 'r')
for line in f:
line = line.strip()
if line.isdigit():
pbs.append(line)
f.close()
pb_string = (',').join(pbs)
#1010 ping to b root
url = "https://atlas.ripe.net/api/v2/measurements/1010/results?start=%d&stop=%d&probe_ids=%s&format=json" \
% (START, END, pb_string)
res = at.query(url)
f = open(MES_PING_FILE, 'w')
f.write(res.text)
f.close()
#5010 ping to b root
url = "https://atlas.ripe.net/api/v2/measurements/5010/results?start=%d&stop=%d&probe_ids=%s&format=json" \
% (START, END, pb_string)
res = at.query(url)
f = open(MES_TRACE_FILE, 'w')
f.write(res.text)
f.close()
if __name__ == "__main__":
main()