# This Python script logs into a Ruckus Smartzone Controller # and performs the following API Calls: # Note: This program assumes you are only using the Default Zone. # import modules import requests import json import getpass # disable SSL certificate warnings requests.packages.urllib3.disable_warnings() # Ask for the username and password. print('Please Enter your username and Password: ') uname = input('Username: ') pword = getpass.getpass(prompt = 'Password: ') # Main API URL to Smartzone 3.6 and login credentials main_api = "https://10.4.2.3:8443/wsg/api/public/v6_0/" body = {'username': uname, 'password': pword} # Create session to retain cookie information # all commands must be in the session to retain the token with requests.session() as s: r = s.post(main_api + "session", data = json.dumps(body), verify = False).json() # Print the Controller Version number and captions version = r['controllerVersion'] print() print('Controller Version: ' + version) print('**************************************') print() print('Here is a list of SSIDs in the Default Zone') print ('-------------------------------------') # Get a list of Zones zone = s.get(main_api + "rkszones").json() zoneId = zone['list'][0]['id'] # Get a list of SSID in the selected zone wlan = s.get(main_api + "rkszones/" + zoneId + "/wlans").json() for each in wlan['list']: print('SSID: ' + each['ssid'])