Skip to content

Instantly share code, notes, and snippets.

@fredhsu
Created October 26, 2014 03:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fredhsu/211afdd5be3fab03cb6c to your computer and use it in GitHub Desktop.
Save fredhsu/211afdd5be3fab03cb6c to your computer and use it in GitHub Desktop.
import json
from jsonrpclib import Server
switches = ["bleaf1", "bleaf2", "bleaf3", "bleaf5"]
username = "admin"
password = "admin"
for switch in switches:
urlString = "https://{}:{}@{}/command-api".format(username, password, switch)
switchReq = Server( urlString )
response = switchReq.runCmds( 1, ["enable", "show running-config"], "text" )
print response
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment