-
Notifications
You must be signed in to change notification settings - Fork 0
/
Get-AF3TagCoords.py
72 lines (63 loc) · 1.64 KB
/
Get-AF3TagCoords.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
import requests
import keyring
baseUrl = 'https://networkasset-conductor.link-labs.com/networkAsset/'
AUTH = ('[email protected]', keyring.get_password("conductor", "[email protected]"))
testGroup1 = [
'C7:01:3F:5C:8E:04',
'C6:60:FE:7A:25:18',
'EA:E0:C5:1B:86:3E',
'CB:60:B3:A1:AD:2D',
'F9:FB:E0:30:2B:58'
]
testGroup2 = [
"CB:B3:E7:18:EF:E9",
"D4:4E:96:89:4A:C4",
"D6:08:ED:C2:92:B0",
"FB:42:64:E7:60:1C",
"DF:1D:16:B2:BF:23"
]
testGroup3 = [
"D3:97:C2:DC:48:33",
"D7:BD:54:1B:E0:AC",
"DA:83:CF:CE:FE:A7",
"E4:F8:3C:B6:E8:56",
"F1:47:72:49:53:17"
]
testGroup4 = [
"FF:FD:D2:0C:20:5B",
"EB:8A:72:D3:2D:03",
"E4:24:EC:CC:58:74",
"DD:C8:EB:A2:EB:A7",
"D2:E8:C7:24:DD:59",
]
testGroupList = [
testGroup1,
testGroup2,
testGroup3,
testGroup4
]
def main(tags):
data = []
for tag in tags:
url = '{}airfinder/v4/tag/{}'.format(baseUrl, tag)
r = requests.get(url, auth=AUTH).json()
coords = [float(r['xCoordinate']) / 10, float(r['yCoordinate']) / 10, float(r['zCoordinate']) / 10]
data.append(coords)
sumx = 0
sumy = 0
sumz = 0
for set in data:
sumx = sumx + set[0]
sumy = sumy + set[1]
sumz = sumz + set[2]
length = len(data)
print(round(sumx/length, 2))
print(round(sumy/length, 2))
print(round(sumz/length, 2))
print('-----------------')
print(data)
if __name__ == "__main__":
for group in testGroupList:
print(str(group))
main(group)
print("\n")