import requestsimport json# define the APs you want to list here:apList = ['34:8F:26:AA:BB:CC', '30:87:D8:00:11:22', '30:87:D9:33:44:55']# define username / password / ip or url belowusername="admin"password="[password]"baseUrl="https://[smartzoneurl-or-ip]:8443/wsg/api/scg# the rest should not need any changesloginData={ "username": username, "password": password, "timeZoneUtcOffset": "+03:00"}headers = {"Content-Type": "application/json;charset=UTF-8"}login=requests.post(baseUrl + "/session", headers=headers, data=json.dumps(loginData))print login.textprint login.status_codeif (login.status_code == requests.codes.ok): cookieJar=login.cookies for myAp in apList: apStatusReq=requests.get( baseUrl + '/aps/' + myAp ,cookies=cookieJar, headers=headers) if (apStatusReq.status_code != requests.codes.ok or not apStatusReq.json()['success']): print myAp, "Not Found!" continue for portInfo in apStatusReq.json()['data']['lanPortStatus']: print myAp, portInfo['interfaceName'], portInfo['logicLink'], portInfo['phyLink'] logoutRequest=requests.delete(baseUrl + '/session', headers=headers, cookies=cookieJar) print logoutRequest.status_code
34:8F:27:AA:BB:CC eth0 Up Up 1000Mbps full34:8F:27:AA:BB:CC eth1 Down Down30:87:D8:00:11:22 Not Found!30:87:D9:33:44:55 eth1 Down Down30:87:D9:33:44:55 eth2 Down Down30:87:D9:33:44:55 eth3 Down Down30:87:D9:33:44:55 eth4 Up Up 100Mbps full30:87:D9:33:44:55 eth0 Up Up 1000Mbps full