forked from KathiraveluLab/CSCEA365-Group-Projects
-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.py
38 lines (30 loc) · 1.41 KB
/
main.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
from GMeasurements.measurements import RipeAtlasMeasurements
from dotenv import load_dotenv
from os import getenv
import json
import csv
if __name__ == "__main__":
load_dotenv()
auth_key = getenv("ATLAS_API_KEY","NONE")
if auth_key == "None":
raise("error getting atlas api key")
# create an instance of class RipeAtlasMeasurement that can be used for a lot of different measurements
measurement = RipeAtlasMeasurements(ATLAS_API_KEY=auth_key)
# # TESTING SUCCESSFUL: get_traceroute_measurement
# # msm1 = measurement.get_traceroute_measurement(61984619)
# # TESTING SUCCESSFUL: create_traceroute_measurement
# probe_list = [60259]
# new_measurement = measurement.create_traceroute_measurement(description="testing", target="ripe.net", af=4, probe_ids=probe_list)
# TESTING PING MEASUREMENT CREATION
new_measurement = measurement.create_measurement()
# appends measurement ids to this csv
with open("data/measurements/test_measurements.csv", mode='a', newline='') as f:
writer = csv.writer(f)
for measurement in new_measurement:
writer.writerow([measurement])
# CREATE CONTINUOUS PING MEASUREMENTS
# new_measurement =
# with open("data/measurements/ping_measurements.csv", mode='a', newline='') as f:
# writer = csv.writer(f)
# for measurement in new_measurement:
# writer.writerow([measurement])