cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
979
Views
0
Helpful
1
Replies

Python script on Nexus9K API Sandbox doesn t work

Hi all,

I have manged to access to GUI on Nexus9K Sandbox. I run show version and copied th python output into a script on my local machine. I run it but I don t get any output. Any idea why?

#!/usr/bin/env python

import requests

import json

from ncclient import manager

url='http://10.10.20.58/ins'

switchuser='cisco'

switchpassword='cisco123'

myheaders={'content-type':'application/json-rpc'}

payload=[

  {

    "jsonrpc": "2.0",

    "method": "cli",

    "params": {

      "cmd": "show version",

      "version": 1

    },

    "id": 1

  }

]

response = requests.post(url,data=json.dumps(payload), headers=myheaders,auth=(switchuser,switchpassword)).json()

federico@federico:~/git/network_automation $ ./nexus_9k_test.py

federico@federico:~/git/network_automation $

1 Reply 1

yawming
Cisco Employee
Cisco Employee

Looks like there is no any "print" statement in the script.