-
Notifications
You must be signed in to change notification settings - Fork 7
/
stats.py
executable file
·27 lines (21 loc) · 965 Bytes
/
stats.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
#!/usr/bin/env python3
import sys
import requests
with open("endpoints.list") as fp:
lines = fp.readlines()
urls = []
for line in lines:
line = "/".join(line.strip().split("/")[:-1])
if not line.startswith(";") and "sdnetrim" in line:
urls.append(line)
for url in urls:
print(url)
name = requests.get(url + "/body/1").json()["name"]
papers = requests.get(url + "/body/1/paper").json()["pagination"]["totalElements"]
meeting = requests.get(url + "/body/1/meeting").json()["pagination"]["totalElements"]
person = requests.get(url + "/body/1/person").json()["pagination"]["totalElements"]
organization = requests.get(url + "/organization").json()["pagination"]["totalElements"]
print("{} has {} papers, {} meetings, {} persons, {} organizations".format(name, papers, meeting, person,
organization))
if __name__ == '__main__':
pass