-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathapp-web-path-stats.py
More file actions
30 lines (26 loc) · 1.08 KB
/
Copy pathapp-web-path-stats.py
File metadata and controls
30 lines (26 loc) · 1.08 KB
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
#
# Print web path stats for all web paths (grouped by organization)
#
from api_fns import *
r1 = get_org()
if r1.status_code == requests.codes.ok:
for organization in r1.json():
print('Org ({}) name --> {}'.format(organization['id'],
organization['displayName']))
r2 = get_web_path_stats(organization['id'])
if r2.status_code == requests.codes.ok:
for web_path_stats in r2.json():
print(' Web path ({})'.format(web_path_stats['webPathId']))
# pp_json(web_path_stats)
if len(web_path_stats['milestones']) > 0:
for test in web_path_stats['milestones'][0]['networkTiming']:
# pp_json(test)
print(' Start time={} Network Timing value={}'
.format(time.ctime(test['start']/1000),
test['value']))
elif r2.status_code == requests.codes.bad_request:
print_err_json(r2.json())
else:
print_err(r2)
else:
print_err(r1)