# This Python script logs into a Ruckus Smartzone Controller # and performs API Calls to get AP information: # 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 Access Points') print ('-------------------------------------') # Get a list of APs aps = s.get(main_api + "aps").json() for each in aps['list']: print('AP Name: ' + each['name']) print('AP MAC Address: ' + each['mac']) print()