Skip to main content

Cisco DNA Center Platform SDK

Project description

Work with the DNA Center APIs in native Python!

dnacentersdk is a community developed Python library for working with the DNA Center APIs. Our goal is to make working with DNA Center in Python a native and natural experience!

from dnacentersdk import api

# Create a DNACenterAPI connection object;
# it uses DNA Center sandbox URL, username and password, with DNA Center API version
# and requests to verify the server's TLS certificate with verify=True.
dnac = api.DNACenterAPI(username="devnetuser",

# Find all devices that have 'Switches and Hubs' in their family
devices = dnac.devices.get_device_list(family='Switches and Hubs')

# Print all of demo devices
for device in devices.response:
    print('{:20s}{}'.format(device.hostname, device.upTime))

# Find all tags
all_tags = dnac.tag.get_tag(sort_by='name', order='des')
demo_tags = [tag for tag in all_tags.response if 'Demo' in ]

#  Delete all of the demo tags
for tag in demo_tags:

# Create a new demo tag
demo_tag = dnac.tag.create_tag(name='dna Demo')
task_demo_tag = dnac.task.get_task_by_id(task_id=demo_tag.response.taskId)

if not task_demo_tag.response.isError:
    # Retrieve created tag
    created_tag = dnac.tag.get_tag(name='dna Demo')

    # Update tag
    update_tag = dnac.tag.update_tag(id=created_tag.response[0].id,
                                     name='Updated ' + created_tag.response[0].name,
                                     description='DNA demo tag')


    # Retrieved updated
    updated_tag = dnac.tag.get_tag(name='Updated dna Demo')
    # Get task error details
    print('Unfortunately ', task_demo_tag.response.progress)
    print('Reason: ', task_demo_tag.response.failureReason)

# Advance usage example using Custom Caller functions
# Define the get_global_credentials and create_netconf_credentials functions
# under the custom_caller wrapper.
# Call them with:
#     dnac.custom_caller.get_global_credentials('NETCONF')
#     dnac.custom_caller.create_netconf_credentials('65533')
def setup_custom():
                            lambda credential_type:
                                        'credentialSubType': credential_type
                            lambda port:
                                        "netconfPort": port

# Add the custom API calls to the connection object under the custom_caller wrapper
# Call the newly added functions



Installing and upgrading dnacentersdk is easy:

Install via PIP

$ pip install dnacentersdk

Upgrading to the latest Version

$ pip install dnacentersdk --upgrade


Excellent documentation is now available at:

Check out the Quickstart to dive in and begin using dnacentersdk.

Release Notes

Please see the releases page for release notes on the incremental functionality and bug fixes incorporated into the published releases.

Questions, Support & Discussion

dnacentersdk is a community developed and community supported project. If you experience any issues using this package, please report them using the issues page.


dnacentersdk is a community development projects. Feedback, thoughts, ideas, and code contributions are welcome! Please see the Contributing guide for more information.


This library is inspired by the webexteamssdk library


All notable changes to this project will be documented in the CHANGELOG file.

The development team may make additional name changes as the library evolves with the Cisco DNA Center APIs.

Copyright (c) 2019-2021 Cisco Systems.

Project details

Download files

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

Source Distribution

dnacentersdk-2.5.0.tar.gz (1.0 MB view hashes)

Uploaded source

Built Distribution

dnacentersdk-2.5.0-py3-none-any.whl (2.8 MB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page