Skip to content

Commit 66ab605

Browse files
Updated for release of API v1 🥳
1 parent c359b45 commit 66ab605

3 files changed

Lines changed: 20 additions & 62 deletions

File tree

‎notebooks/merakiOfflineSwitchFinder.ipynb‎

Lines changed: 16 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -22,20 +22,14 @@
2222
},
2323
{
2424
"cell_type": "code",
25-
"execution_count": 1,
25+
"execution_count": null,
2626
"metadata": {
2727
"tags": []
2828
},
29-
"outputs": [
30-
{
31-
"output_type": "stream",
32-
"name": "stdout",
33-
"text": "Requirement already satisfied: meraki==1.0.0b15 in c:\\users\\john.kuchta\\appdata\\local\\programs\\python\\python38-32\\lib\\site-packages (1.0.0b15)\nRequirement already satisfied: aiohttp in c:\\users\\john.kuchta\\appdata\\local\\programs\\python\\python38-32\\lib\\site-packages (from meraki==1.0.0b15) (3.6.2)\nRequirement already satisfied: requests in c:\\users\\john.kuchta\\appdata\\local\\programs\\python\\python38-32\\lib\\site-packages (from meraki==1.0.0b15) (2.24.0)Note: you may need to restart the kernel to use updated packages.\nRequirement already satisfied: attrs>=17.3.0 in c:\\users\\john.kuchta\\appdata\\local\\programs\\python\\python38-32\\lib\\site-packages (from aiohttp->meraki==1.0.0b15) (19.3.0)\nRequirement already satisfied: multidict<5.0,>=4.5 in c:\\users\\john.kuchta\\appdata\\local\\programs\\python\\python38-32\\lib\\site-packages (from aiohttp->meraki==1.0.0b15) (4.7.6)\nRequirement already satisfied: chardet<4.0,>=2.0 in c:\\users\\john.kuchta\\appdata\\local\\programs\\python\\python38-32\\lib\\site-packages (from aiohttp->meraki==1.0.0b15) (3.0.4)\nRequirement already satisfied: async-timeout<4.0,>=3.0 in c:\\users\\john.kuchta\\appdata\\local\\programs\\python\\python38-32\\lib\\site-packages (from aiohttp->meraki==1.0.0b15) (3.0.1)\nRequirement already satisfied: yarl<2.0,>=1.0 in c:\\users\\john.kuchta\\appdata\\local\\programs\\python\\python38-32\\lib\\site-packages (from aiohttp->meraki==1.0.0b15) (1.4.2)\nRequirement already satisfied: urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 in c:\\users\\john.kuchta\\appdata\\local\\programs\\python\\python38-32\\lib\\site-packages (from requests->meraki==1.0.0b15) (1.25.9)\nRequirement already satisfied: certifi>=2017.4.17 in c:\\users\\john.kuchta\\appdata\\local\\programs\\python\\python38-32\\lib\\site-packages (from requests->meraki==1.0.0b15) (2020.6.20)\nRequirement already satisfied: idna<3,>=2.5 in c:\\users\\john.kuchta\\appdata\\local\\programs\\python\\python38-32\\lib\\site-packages (from requests->meraki==1.0.0b15) (2.10)\n\nWARNING: You are using pip version 20.1.1; however, version 20.2.1 is available.\nYou should consider upgrading via the 'C:\\Users\\john.kuchta\\AppData\\Local\\Programs\\Python\\Python38-32\\python.exe -m pip install --upgrade pip' command.\nWARNING: You are using pip version 20.1.1; however, version 20.2.1 is available.\nYou should consider upgrading via the 'C:\\Users\\john.kuchta\\AppData\\Local\\Programs\\Python\\Python38-32\\python.exe -m pip install --upgrade pip' command.\nRequirement already satisfied: tablib in c:\\users\\john.kuchta\\appdata\\local\\programs\\python\\python38-32\\lib\\site-packages (2.0.0)\nNote: you may need to restart the kernel to use updated packages.\n meraki: INFO > Meraki dashboard API session initialized with these parameters: {'version': '1.0.0b15', 'api_key': '************************************dfb9', 'base_url': 'https://api.meraki.com/api/v1', 'single_request_timeout': 60, 'certificate_path': '', 'requests_proxy': '', 'wait_on_rate_limit': True, 'nginx_429_retry_wait_time': 60, 'action_batch_retry_wait_time': 60, 'retry_4xx_error': False, 'retry_4xx_error_wait_time': 60, 'maximum_retries': 2, 'simulate': False, 'be_geo_id': None, 'caller': None}\n"
34-
}
35-
],
29+
"outputs": [],
3630
"source": [
3731
"# Install the relevant modules. If you are using a local editor (e.g. VS Code, rather than Colab) you can run these commands, without the preceding %, via a terminal. NB: Run `pip install meraki==` to find the latest version of the Meraki SDK.\n",
38-
"%pip install meraki==1.0.0b15\n",
32+
"%pip install meraki\n",
3933
"%pip install tablib\n",
4034
"\n",
4135
"# If you are using Google Colab, please ensure you have set up your environment variables as linked above, then delete the two lines of ''' to activate the following code:\n",
@@ -71,7 +65,7 @@
7165
},
7266
{
7367
"cell_type": "code",
74-
"execution_count": 2,
68+
"execution_count": null,
7569
"metadata": {},
7670
"outputs": [],
7771
"source": [
@@ -92,17 +86,11 @@
9286
},
9387
{
9488
"cell_type": "code",
95-
"execution_count": 3,
89+
"execution_count": null,
9690
"metadata": {
9791
"tags": []
9892
},
99-
"outputs": [
100-
{
101-
"output_type": "stream",
102-
"name": "stderr",
103-
"text": "meraki: INFO > organizations, getOrganizations - 200 OK\nOrganizations:\n[\n {\n \"id\": \"102908\",\n \"name\": \"Olympus\",\n \"url\": \"https://n80.meraki.com/o/99uSJa/manage/organization/overview\"\n }\n]\n\nThe firstOrganizationId is 102908, and its name is Olympus.\n"
104-
}
105-
],
93+
"outputs": [],
10694
"source": [
10795
"# Let's make it easier to call this data later\n",
10896
"# getOrganizations will return all orgs to which the supplied API key has access\n",
@@ -128,17 +116,11 @@
128116
},
129117
{
130118
"cell_type": "code",
131-
"execution_count": 4,
119+
"execution_count": null,
132120
"metadata": {
133121
"tags": []
134122
},
135-
"outputs": [
136-
{
137-
"output_type": "stream",
138-
"name": "stderr",
139-
"text": "meraki: INFO > organizations, getOrganizationNetworks; page 1 - 200 OK\nNetworks:\n[\n {\n \"enrollmentString\": null,\n \"id\": \"L_607985949695028290\",\n \"name\": \"Edgehill2\",\n \"organizationId\": \"102908\",\n \"productTypes\": [\n \"appliance\",\n \"camera\",\n \"cellularGateway\",\n \"switch\",\n \"wireless\"\n ],\n \"tags\": [],\n \"timeZone\": \"America/Los_Angeles\",\n \"url\": \"https://n80.meraki.com/Edgehill2-applia/n/wyTiUcqb/manage/usage/list\"\n },\n {\n \"enrollmentString\": null,\n \"id\": \"L_607985949695028346\",\n \"name\": \"Virtual\",\n \"organizationId\": \"102908\",\n \"productTypes\": [\n \"appliance\",\n \"camera\",\n \"switch\",\n \"wireless\"\n ],\n \"tags\": [],\n \"timeZone\": \"America/Los_Angeles\",\n \"url\": \"https://n80.meraki.com/Virtual-camera/n/mlMVmcqb/manage/usage/list\"\n },\n {\n \"enrollmentString\": null,\n \"id\": \"L_607985949695028380\",\n \"name\": \"Western\",\n \"organizationId\": \"102908\",\n \"productTypes\": [\n \"appliance\",\n \"cellularGateway\",\n \"switch\",\n \"wireless\"\n ],\n \"tags\": [],\n \"timeZone\": \"America/Los_Angeles\",\n \"url\": \"https://n80.meraki.com/Western-wireless/n/nQiaYbqb/manage/usage/list\"\n },\n {\n \"enrollmentString\": null,\n \"id\": \"L_607985949695028389\",\n \"name\": \"Edgehill\",\n \"organizationId\": \"102908\",\n \"productTypes\": [\n \"appliance\",\n \"cellularGateway\"\n ],\n \"tags\": [],\n \"timeZone\": \"America/Los_Angeles\",\n \"url\": \"https://n80.meraki.com/Edgehill-cellula/n/SXmkodqb/manage/usage/list\"\n },\n {\n \"enrollmentString\": null,\n \"id\": \"N_607985949695061056\",\n \"name\": \"Switch\",\n \"organizationId\": \"102908\",\n \"productTypes\": [\n \"switch\"\n ],\n \"tags\": [],\n \"timeZone\": \"America/Los_Angeles\",\n \"url\": \"https://n80.meraki.com/Switch/n/4QMMjbqb/manage/usage/list\"\n }\n]\n\nThe firstNetworkId is L_607985949695028290, and its name is Edgehill2.\n"
140-
}
141-
],
123+
"outputs": [],
142124
"source": [
143125
"networks = dashboard.organizations.getOrganizationNetworks(organizationId=firstOrganizationId)\n",
144126
"print('Networks:')\n",
@@ -168,17 +150,11 @@
168150
},
169151
{
170152
"cell_type": "code",
171-
"execution_count": 5,
153+
"execution_count": null,
172154
"metadata": {
173155
"tags": []
174156
},
175-
"outputs": [
176-
{
177-
"output_type": "stream",
178-
"name": "stderr",
179-
"text": "meraki: INFO > organizations, getOrganizationDevices; page 1 - 200 OK\n meraki: INFO > organizations, getOrganizationDevicesStatuses; page 1 - 200 OK\nThese are the switches:\n[\n {\n \"address\": \"4111 Edgehill Dr, Los Angeles, CA 90008\",\n \"configurationUpdatedAt\": \"2020-07-21T01:57:44Z\",\n \"firmware\": \"switch-12-17\",\n \"lanIp\": \"172.17.0.4\",\n \"lat\": 34.00968,\n \"lng\": -118.33069,\n \"mac\": \"34:56:fe:cc:b9:84\",\n \"model\": \"MS120-8LP\",\n \"name\": \"Edgehill MS120-8LP\",\n \"networkId\": \"L_607985949695028290\",\n \"notes\": \"\",\n \"serial\": \"Q2BX-DEZ3-LGMD\",\n \"tags\": [],\n \"url\": \"https://n80.meraki.com/Edgehill2-switch/n/V3nOZcqb/manage/nodes/new_list/57548246661508\"\n },\n {\n \"address\": \"\",\n \"configurationUpdatedAt\": \"2020-07-07T00:08:05Z\",\n \"firmware\": \"Not running configured version\",\n \"lanIp\": null,\n \"lat\": 37.4180951010362,\n \"lng\": -122.098531723022,\n \"mac\": \"4c:c8:a1:06:00:f8\",\n \"model\": \"MS250-24\",\n \"name\": \"\",\n \"networkId\": \"L_607985949695028346\",\n \"notes\": \"\",\n \"serial\": \"QBSB-AK7F-URKC\",\n \"tags\": [],\n \"url\": \"https://n80.meraki.com/Virtual-switch/n/IItm2bqb/manage/nodes/new_list/84424578695416\"\n },\n {\n \"address\": \"\",\n \"configurationUpdatedAt\": \"2020-07-07T23:36:50Z\",\n \"firmware\": \"Not running configured version\",\n \"lanIp\": null,\n \"lat\": 37.4180951010362,\n \"lng\": -122.098531723022,\n \"mac\": \"4c:c8:a1:08:00:09\",\n \"model\": \"MS410-16\",\n \"name\": \"\",\n \"networkId\": \"L_607985949695028346\",\n \"notes\": \"\",\n \"serial\": \"QBSB-BDX9-8AZP\",\n \"tags\": [],\n \"url\": \"https://n80.meraki.com/Virtual-switch/n/IItm2bqb/manage/nodes/new_list/84424578826249\"\n },\n {\n \"address\": \"\",\n \"configurationUpdatedAt\": \"2020-07-07T00:08:05Z\",\n \"firmware\": \"Not running configured version\",\n \"lanIp\": null,\n \"lat\": 37.4180951010362,\n \"lng\": -122.098531723022,\n \"mac\": \"4c:c8:a1:09:00:f8\",\n \"model\": \"MS425-32\",\n \"name\": \"\",\n \"networkId\": \"L_607985949695028346\",\n \"notes\": \"\",\n \"serial\": \"QBSB-DD84-RCQS\",\n \"tags\": [],\n \"url\": \"https://n80.meraki.com/Virtual-switch/n/IItm2bqb/manage/nodes/new_list/84424578892024\"\n },\n {\n \"address\": \"\",\n \"configurationUpdatedAt\": \"2020-07-07T23:36:50Z\",\n \"firmware\": \"Not running configured version\",\n \"lanIp\": null,\n \"lat\": 37.4180951010362,\n \"lng\": -122.098531723022,\n \"mac\": \"4c:c8:a1:08:00:0a\",\n \"model\": \"MS410-16\",\n \"name\": \"\",\n \"networkId\": \"L_607985949695028346\",\n \"notes\": \"\",\n \"serial\": \"QBSB-DLV3-235C\",\n \"tags\": [\n \"APIness\"\n ],\n \"url\": \"https://n80.meraki.com/Virtual-switch/n/IItm2bqb/manage/nodes/new_list/84424578826250\"\n },\n {\n \"address\": \"\",\n \"configurationUpdatedAt\": \"2020-07-07T00:08:05Z\",\n \"firmware\": \"Not running configured version\",\n \"lanIp\": null,\n \"lat\": 37.4180951010362,\n \"lng\": -122.098531723022,\n \"mac\": \"4c:c8:a1:07:00:f8\",\n \"model\": \"MS350-48LP\",\n \"name\": \"\",\n \"networkId\": \"L_607985949695028346\",\n \"notes\": \"\",\n \"serial\": \"QBSB-E3LG-VEQZ\",\n \"tags\": [],\n \"url\": \"https://n80.meraki.com/Virtual-switch/n/IItm2bqb/manage/nodes/new_list/84424578760952\"\n },\n {\n \"address\": \"\",\n \"configurationUpdatedAt\": \"2020-07-07T23:36:50Z\",\n \"firmware\": \"Not running configured version\",\n \"lanIp\": null,\n \"lat\": 37.4180951010362,\n \"lng\": -122.098531723022,\n \"mac\": \"4c:c8:a1:08:00:f8\",\n \"model\": \"MS410-16\",\n \"name\": \"\",\n \"networkId\": \"L_607985949695028346\",\n \"notes\": \"\",\n \"serial\": \"QBSB-HXH8-6N32\",\n \"tags\": [],\n \"url\": \"https://n80.meraki.com/Virtual-switch/n/IItm2bqb/manage/nodes/new_list/84424578826488\"\n },\n {\n \"address\": \"\",\n \"configurationUpdatedAt\": \"2020-07-07T00:08:05Z\",\n \"firmware\": \"Not running configured version\",\n \"lanIp\": null,\n \"lat\": 37.4180951010362,\n \"lng\": -122.098531723022,\n \"mac\": \"4c:c8:a1:05:00:f8\",\n \"model\": \"MS120-8FP\",\n \"name\": \"\",\n \"networkId\": \"L_607985949695028346\",\n \"notes\": \"\",\n \"serial\": \"QBSB-PP5Z-HJ84\",\n \"tags\": [],\n \"url\": \"https://n80.meraki.com/Virtual-switch/n/IItm2bqb/manage/nodes/new_list/84424578629880\"\n },\n {\n \"address\": \"\",\n \"configurationUpdatedAt\": \"2020-07-07T23:36:50Z\",\n \"firmware\": \"Not running configured version\",\n \"lanIp\": null,\n \"lat\": 37.4180951010362,\n \"lng\": -122.098531723022,\n \"mac\": \"4c:c8:a1:08:00:0b\",\n \"model\": \"MS410-16\",\n \"name\": \"\",\n \"networkId\": \"L_607985949695028346\",\n \"notes\": \"\",\n \"serial\": \"QBSB-YYWS-RCY7\",\n \"tags\": [\n \"APIness\"\n ],\n \"url\": \"https://n80.meraki.com/Virtual-switch/n/IItm2bqb/manage/nodes/new_list/84424578826251\"\n }\n]\n"
180-
}
181-
],
157+
"outputs": [],
182158
"source": [
183159
"devices = dashboard.organizations.getOrganizationDevices(organizationId=firstOrganizationId)\n",
184160
"devices_statuses = dashboard.organizations.getOrganizationDevicesStatuses(organizationId=firstOrganizationId)\n",
@@ -201,17 +177,11 @@
201177
},
202178
{
203179
"cell_type": "code",
204-
"execution_count": 6,
180+
"execution_count": null,
205181
"metadata": {
206182
"tags": []
207183
},
208-
"outputs": [
209-
{
210-
"output_type": "stream",
211-
"name": "stdout",
212-
"text": "We can list out the statuses (and whatever metadata we need) for these switches:\nSwitch statuses are:\n[\n {\n \"serial\": \"Q2BX-DEZ3-LGMD\",\n \"status\": \"offline\"\n },\n {\n \"serial\": \"QBSB-AK7F-URKC\",\n \"status\": \"offline\"\n },\n {\n \"serial\": \"QBSB-BDX9-8AZP\",\n \"status\": \"offline\"\n },\n {\n \"serial\": \"QBSB-DD84-RCQS\",\n \"status\": \"offline\"\n },\n {\n \"serial\": \"QBSB-DLV3-235C\",\n \"status\": \"offline\"\n },\n {\n \"serial\": \"QBSB-E3LG-VEQZ\",\n \"status\": \"offline\"\n },\n {\n \"serial\": \"QBSB-HXH8-6N32\",\n \"status\": \"offline\"\n },\n {\n \"serial\": \"QBSB-PP5Z-HJ84\",\n \"status\": \"offline\"\n },\n {\n \"serial\": \"QBSB-YYWS-RCY7\",\n \"status\": \"offline\"\n }\n]\n\nWe can narrow it down to the ones that are offline:\nOffline switches are:\n[\n {\n \"serial\": \"Q2BX-DEZ3-LGMD\",\n \"status\": \"offline\"\n },\n {\n \"serial\": \"QBSB-AK7F-URKC\",\n \"status\": \"offline\"\n },\n {\n \"serial\": \"QBSB-BDX9-8AZP\",\n \"status\": \"offline\"\n },\n {\n \"serial\": \"QBSB-DD84-RCQS\",\n \"status\": \"offline\"\n },\n {\n \"serial\": \"QBSB-DLV3-235C\",\n \"status\": \"offline\"\n },\n {\n \"serial\": \"QBSB-E3LG-VEQZ\",\n \"status\": \"offline\"\n },\n {\n \"serial\": \"QBSB-HXH8-6N32\",\n \"status\": \"offline\"\n },\n {\n \"serial\": \"QBSB-PP5Z-HJ84\",\n \"status\": \"offline\"\n },\n {\n \"serial\": \"QBSB-YYWS-RCY7\",\n \"status\": \"offline\"\n }\n]\n"
213-
}
214-
],
184+
"outputs": [],
215185
"source": [
216186
"# Now we can list out the statuses (and whatever metadata we need) for these switches\n",
217187
"print('We can list out the statuses (and whatever metadata we need) for these switches:')\n",
@@ -238,17 +208,11 @@
238208
},
239209
{
240210
"cell_type": "code",
241-
"execution_count": 7,
211+
"execution_count": null,
242212
"metadata": {
243213
"tags": []
244214
},
245-
"outputs": [
246-
{
247-
"output_type": "stream",
248-
"name": "stdout",
249-
"text": "[\n {\n \"lastReportedAt\": \"2020-07-22 20:14:17.501\",\n \"serial\": \"Q2BX-DEZ3-LGMD\"\n },\n {\n \"lastReportedAt\": null,\n \"serial\": \"QBSB-AK7F-URKC\"\n },\n {\n \"lastReportedAt\": null,\n \"serial\": \"QBSB-BDX9-8AZP\"\n },\n {\n \"lastReportedAt\": null,\n \"serial\": \"QBSB-DD84-RCQS\"\n },\n {\n \"lastReportedAt\": null,\n \"serial\": \"QBSB-DLV3-235C\"\n },\n {\n \"lastReportedAt\": null,\n \"serial\": \"QBSB-E3LG-VEQZ\"\n },\n {\n \"lastReportedAt\": null,\n \"serial\": \"QBSB-HXH8-6N32\"\n },\n {\n \"lastReportedAt\": null,\n \"serial\": \"QBSB-PP5Z-HJ84\"\n },\n {\n \"lastReportedAt\": null,\n \"serial\": \"QBSB-YYWS-RCY7\"\n }\n]\n"
250-
}
251-
],
215+
"outputs": [],
252216
"source": [
253217
"# Another list comprehension!\n",
254218
"devices_last_reported_times = [{'serial': i['serial'], 'lastReportedAt': i['lastReportedAt']} for i in devices_statuses if i['serial'] in devices_switches_serials]\n",
@@ -267,17 +231,11 @@
267231
},
268232
{
269233
"cell_type": "code",
270-
"execution_count": 13,
234+
"execution_count": null,
271235
"metadata": {
272236
"tags": []
273237
},
274-
"outputs": [
275-
{
276-
"output_type": "stream",
277-
"name": "stdout",
278-
"text": "serial |lastReportedAt \n--------------|-----------------------\nQ2BX-DEZ3-LGMD|2020-07-22 20:14:17.501\nQBSB-AK7F-URKC|None \nQBSB-BDX9-8AZP|None \nQBSB-DD84-RCQS|None \nQBSB-DLV3-235C|None \nQBSB-E3LG-VEQZ|None \nQBSB-HXH8-6N32|None \nQBSB-PP5Z-HJ84|None \nQBSB-YYWS-RCY7|None \n"
279-
}
280-
],
238+
"outputs": [],
281239
"source": [
282240
"# Let's convert that JSON-formatted data to a tabular dataset. You can copy/paste this into Excel, or write additional Python to create a new Excel file entirely!\n",
283241
"excel_formatted = tablib.import_set(json.dumps(devices_last_reported_times), format = 'json')\n",

‎notebooks/merakiSSIDLimitsChecker.ipynb‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
"outputs": [],
3232
"source": [
3333
"# Install the relevant modules. If you are using a local editor (e.g. VS Code, rather than Colab) you can run these commands, without the preceding %, via a terminal. NB: Run `pip install meraki==` to find the latest version of the Meraki SDK.\n",
34-
"%pip install meraki==1.0.0b15\n",
34+
"%pip install meraki\n",
3535
"%pip install tablib\n",
3636
"\n",
3737
"# If you are using Google Colab, please ensure you have set up your environment variables as linked above, then delete the two lines of ''' to activate the following code:\n",

‎notebooks/notebooksReadme.md‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,10 +131,10 @@ Unlike local Python environments, Colab environments are not persistent. Therefo
131131
%pip install PACKAGE_NAME
132132
```
133133

134-
For example, to install the Meraki SDK (replace `1.0.0b15` with whatever version you plan to use):
134+
For example, to install the Meraki SDK:
135135

136136
```python
137-
%pip install meraki==1.0.0b15
137+
%pip install meraki
138138
```
139139

140140
If necessary, create a new code cell at the top of the notebook, paste in that code, and run it before working with the rest of your notebook.
@@ -144,7 +144,7 @@ If necessary, create a new code cell at the top of the notebook, paste in that c
144144
At a terminal, run:
145145

146146
```shell
147-
pip install meraki==1.0.0b15
147+
pip install meraki
148148
```
149149

150150
Other packages can be installed the same way using the relevant package name. Try it with `tablib`!

0 commit comments

Comments
 (0)