-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathget_mx_url.py
More file actions
42 lines (32 loc) · 942 Bytes
/
get_mx_url.py
File metadata and controls
42 lines (32 loc) · 942 Bytes
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 meraki
import time
import pickle
def store_id():
API_KEY = ''
org_id = ''
dashboard = meraki.DashboardAPI(API_KEY)
n = dashboard.organizations.getOrganizationNetworks(org_id, total_pages='all')
stores = []
for e in n:
s = e['id'], e['name'], e['tags']
stores.append(s)
urls = []
for id in stores:
devicess = dashboard.networks.getNetworkDevices(id[0])
for d in devicess:
if 'MX' in d['model']:
try:
if 'merakiname' in d['name']:
net_dev = d['url'], d['serial'], id[1]
urls.append([net_dev])
time.sleep(1)
except:
continue
else:
continue
else:
continue
file = open('pmx.pkl', 'wb')
pickle.dump(urls, file)
file.close()
store_id()