def __init__(self): loginmgr = PersistentLogin("admin","admin") self.wsc = NOXWSClient("127.0.0.1", 443, True, loginmgr) self.debug = True
def __init__(self): loginmgr = PersistentLogin("admin", "admin") self.wsc = NOXWSClient("127.0.0.1", 8888, False, loginmgr) self.print_progress = True self.print_requests = False
command = a elif o == '-u': adminu = a elif o == '-p': adminp = a else: assert False, "unhandled option" if not directory or not switch or not command: usage() sys.exit() print ' Logging into web service.. ', loginmgr = PersistentLogin("admin", "admin") # currently only support localhost wsc = NOXWSClient("127.0.0.1", 443, True, loginmgr) print 'done' urlstr = '/ws.v1/switch/' + directory + '/' + switch + '/command' print ' Issuing:' print '\t', urlstr url = urllib.quote(urlstr) d = {} d['command'] = command d['args'] = args headers = {} headers["content-type"] = "application/json" response = wsc.put(url, headers, simplejson.dumps(d)) body = response.getBody()