-
Notifications
You must be signed in to change notification settings - Fork 0
/
gvl.py
43 lines (35 loc) · 1 KB
/
gvl.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
39
40
41
42
import json
import urllib
from urllib.request import urlopen
strGvl = "https://vendor-list.consensu.org/v3/vendor-list.json"
f = urlopen(strGvl).read()
dictGvl = json.loads(f)
dictVendors = dictGvl['vendors']
#return the total number of vendors in the GVL
print("Total numbers of vendors: ")
print(len(dictVendors))
## return the vendor list
## print("Vendor list dump: ")
## print(dictVendors)
##return the names of the vendors
##print("Vendor names: ")
##for x in dictVendors:
### print(x)
# print(dictVendors[x]['name'])
### print(dictVendors[x])
#return the numbers and names of deleted vendor
i = 0
for x in dictVendors:
if 'deletedDate' in dictVendors[x]:
i += 1
print("Number of deleted vendors: ", i)
## print the names of the deleted vendors:
for x in dictVendors:
if 'deletedDate' in dictVendors[x]:
print(dictVendors[x]['name'])
#return the number of operatable vendors
i = 0
for x in dictVendors:
if 'deletedDate' not in dictVendors[x]:
i += 1
print("Number of operatable vendors: ", i)