[ { "title":"Meraki", "url":"/meraki/" }, { "title":"Explore", "url":"/meraki/explore/" }, { "title":"Meraki Python Library Installation Guide" } ] Code Exchange https://developer.cisco.com/codeexchange/platforms/meraki _blank

Meraki Python Library Installation Guide

The Meraki Dashboard API is a powerful way of interacting with your network. To streamline your development, a Python module has been written with all of the available API calls. This allows for instant interaction with API without the overhead of writing the request calls.

This guide will get you up and running with the Meraki Python library module.

For macOS users

  1. Install Homebrew first, if not already present, in terminal:
    > ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
  2. Install Python 3.6
    > brew install python3
  3. Install the requests module
    > pip3 install requests
  4. Install Dashboard API module
    > pip3 install meraki

    If previously installed, upgrade

    > pip3 install meraki --upgrade
  5. To make sure your installation is successful, launch Python
    > python3
  6. Using your API key, run the following commands to import the meraki and list the organizations
    >>> from meraki import meraki
    >>> meraki.myorgaccess('42a2e94ea6092c11e323bc750f368c9ede56c8ba')
  7. You should see the following returned
    [{'id': 640799, 'name': 'Meraki API Lab'}]

For Windows users

  1. Download the latest 3.6 version from https://www.python.org/downloads/
  2. Be sure to select the “Add Python 3.6 to PATH” checkbox, then “install Now”.
  3. Install the requests module, in command prompt (cmd.exe)
    > pip install requests
  4. Install Dashboard API module
    > pip install meraki

    If previously installed, upgrade

    > pip install meraki --upgrade
  5. To make sure your installation is successful, launch Python
    > python
    
  6. Using your API key, run the following commands to import the meraki and list the organizations
    >>> from meraki import meraki
    >>> meraki.myorgaccess('42a2e94ea6092c11e323bc750f368c9ede56c8ba')
  7. You should see the following returned:
    [{'id': 640799, 'name': 'Meraki API Lab'}]

Additional Resources

Text editors

  1. Download a developer text editor if you don’t already have one. Some options include Sublime, Atom, Visual Studio Code, and Notepad++.
  2. Native TextEdit on macOS or Notepad/WordPad on Windows will not suffice! In addition, watch out for these editors altering certain characters like quotes to non-ASCII encoding, which will cause problems.

 

Source Code

Python Library

Labs

Automation Learning Lab

Python Basics

Python Jumpstart Slides