Skip to main content

Cisco Meraki Dashboard API library

Project description

Meraki Dashboard API Python Library

The new Meraki Dashboard API Python library provides all current Meraki Dashboard API calls to interface with the Cisco Meraki cloud-managed platform. The library is supported on Python 3.6 or above, and you can install it via PyPI:

pip install meraki

Features

This library's goal is to refresh and supplant the legacy module (this repository versions 0.34 and prior) as well as the now-deprecated SDK. Here are some of the features in this revamped library:

  • Support for all API endpoints, as it uses the OpenAPI specification to generate source code
  • Log all API requests made to a local file as well as on-screen console
  • Automatic retries upon 429 rate limit errors, using the Retry-After field within response headers
  • Get all (or a specified number of) pages of data with built-in pagination control
  • Tweak settings such as the default base URL (for example, to use with V1 and/or mega-proxy)
  • Simulate POST/PUT/DELETE calls to preview first, so that network configuration does not get changed
  • Includes the legacy module's functions for backward compatibility

Setup

  1. Enable API access in your Meraki dashboard organization and obtain an API key (instructions)

  2. Keep your API key safe and secure, as it is similar to a password for your dashboard. If publishing your Python code to a wider audience, please research secure handling of API keys.

  3. Although the Meraki dashboard API, as a REST API, can be accessed in various ways, this library uses Python 3.6+. (get started with Python)

  4. After Python 3 is installed, use pip (or an alternative such as easy_install) to install the library:

    • pip install meraki
    • If you have both Python3 and Python2 installed, you may need to use pip3 install meraki
    • If meraki was previously installed, you can upgrade with pip install --upgrade meraki or pip3 install --upgrade meraki

Usage

  1. Export your API key as an environment variable, for example:

    export MERAKI_DASHBOARD_API_KEY=093b24e85df15a3e66f1fc359f4c48493eaa1b73

  2. Alternatively, define your API key as a variable in your source code; this method is not recommended due to its inherent insecurity.

  3. Single line of code to import and use the library goes at the top of your script:

    import meraki

  4. Instantiate the client (API consumer class), optionally specifying any of the parameters available to set:

    dashboard = meraki.DashboardAPI()

  5. Make dashboard API calls in your source code, using the format client.section.operation, where client is the name you defined in the previous step (dashboard above), section is the corresponding group (or tag from the OpenAPI spec) from the API docs, and operation is the name (or operation ID from OpenAPI) of the API endpoint. For example, to make a call to get the list of organizations accessible by the API key defined in step 1, use this function call:

    my_orgs = dashboard.organizations.getOrganizations()

  6. If you were using this module versions 0.34 and prior, that file's functions are included in the legacy.py file, and you can adapt your existing scripts by replacing their from meraki import meraki line to import meraki

For a full working script that demos this library, please see and run the org_wide_clients.py file included (in examples folder). That code collects the clients of all networks, in all orgs to which the key has access. No changes are made, since only GET endpoints are called, and the data is written to local CSV output files.

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

meraki-0.90.0.tar.gz (122.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

meraki-0.90.0-py3-none-any.whl (214.5 kB view details)

Uploaded Python 3

File details

Details for the file meraki-0.90.0.tar.gz.

File metadata

  • Download URL: meraki-0.90.0.tar.gz
  • Upload date:
  • Size: 122.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.7.4

File hashes

Hashes for meraki-0.90.0.tar.gz
Algorithm Hash digest
SHA256 176b9d5834ee81b6588a47fdda790c8ab99ced08a14e43b3f0f0029d5f2cb2eb
MD5 c2c618ca855b699f628046e4f93129b7
BLAKE2b-256 8c186ed8ccf376427d70eeaa55f3ffc8f6c62b93f29aef7310d39211c0a50025

See more details on using hashes here.

File details

Details for the file meraki-0.90.0-py3-none-any.whl.

File metadata

  • Download URL: meraki-0.90.0-py3-none-any.whl
  • Upload date:
  • Size: 214.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.7.4

File hashes

Hashes for meraki-0.90.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8ac1171842c08cfe3aa5d55121d6096e50881f886a410b4f77962a7bcb44ca75
MD5 1973d2bcbb88c4bf8a10c82c834e379d
BLAKE2b-256 2ec2390bc0e872aa1d53d083307f9de8274d3727c2a4213d0e944afb7b387bf0

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page