Traceback:
(venv) JRIGLER-M-G5SZ:intro-dnac jrigler$ ./cmd-run/show_command.py Traceback (most recent call last): File "./cmd-run/show_command.py", line 112, in <module> results_fileId = execute_commands(token, deviceIdList, commandList) File "./cmd-run/show_command.py", line 47, in execute_commands task_result = post_and_wait(token,url, payload) File "./cmd-run/show_command.py", line 25, in post_and_wait taskid = response.json()['response']['taskId'] KeyError: 'response'
Associated code line (line 25):
taskid = response.json()['response']['taskId']
when parsing response from '/v1/network-device-poller/cli/read-request'.
Running as 'devnetuser' against Always On SandBox (1.2.6)
(
* URL: https://sandboxdnac.cisco.com/
* Username: devnetuser
* Password: Cisco123!
)
Executing with same credentials in POSTMAN returns results:
HTTP Status: 403 Forbidden
and
{
"message": "Role does not have valid permissions to access the API"
}
This sample code is used in Learning Lab "Execute Commands Across the Network with Cisco DNA Center Platform and Command Runner", so should not fail - with traceback but should handle invalid role.