DevNet Associate DEVASC 200-901 Official Certification Guide by Adrian Iliesiu (z-lib.org)

(andrew) #1

Meraki SDKs for the Dashboard API: one is Python
based and the other is Node.js based. The Meraki Python
SDK used in this book is version 1.0.2; it was developed
for Python 3 and implements a complete set of classes,
methods, and functions to simplify how users interact
with the Dashboard API in Python.


In order to get access to the SDK, you need to install the
meraki-sdk module. As a best practice, always use virtual
environments with all Python projects. Once a virtual
environment is activated, you can run pip install
meraki-sdk to get the latest version of the SDK. In this
section, you follow the same three steps you have
followed in other examples in this chapter: Get the
organization ID for the DevNet Sandbox account, get a
list of all the networks that are part of this organization,
and get all the devices associated to the “DevNet Always
on Read Only” network. The Python 3 code to
accomplish these three tasks might look as shown in
Example 8-4.


You need to import the MerakiSdkClient class from the
meraki_sdk module. You use the MerakiSdkClient class
to create an API client by passing the API key as a
parameter and creating an instance of this class called
MERAKI.


Example 8-4 Python Script That Uses meraki_sdk

Click here to view code image


#! /usr/bin/env python
from meraki_sdk.meraki_sdk_client import
MerakiSdkClient
#Cisco DevNet Sandbox Meraki API key
X_CISCO_MERAKI_API_KEY =
'15da0c6ffff295f16267f88f98694cf29a86ed87'
#Establish a new client connection to the
Meraki REST API
MERAKI =
MerakiSdkClient(X_CISCO_MERAKI_API_KEY)
Free download pdf