Hi,
Do you have check the log on the switch ?
Can you update to 16.10.0012, there is fix about REST and PowerShell may be the same issue with python...
------------------------------
PowerArubaSW : Powershell Module to use Aruba Switch API for Vlan, VlanPorts, LACP, LLDP...
PowerArubaCP: Powershell Module to use ClearPass API (create NAD, Guest...)
PowerArubaCX: Powershell Module to use ArubaCX API (get interface/vlan/ports info)..
ACEP / ACMX #107 / ACDX #1281
------------------------------
Original Message:
Sent: Jan 23, 2021 11:14 AM
From: Jose Moreno
Subject: ArubaOS-Switch WC.16.10.0011 : cannot login with Python
Here's an example of script that works perfecty on WC.16.10.0002 , but not on WC.16.10.0011 :
# https://arubaos-switch-rest-guide.readthedocs.io/en/latest/import reimport requestsimport json# Use authentication call and pass credentialsurl="http://" + "x.x.x.x" + "/rest/v1/login-sessions"data = {"userName":"manager","password":"x"}r = requests.post(url, data=json.dumps(data), verify=False)# Parse tokencookie = r.json()["cookie"].split("=")[1]print("Cookie: " + cookie)# Prepare JSON structure with ip address and tokenlogin = {"ip":"x.x.x.x","cookie":cookie}# Write JSON to file to be read by other scriptsf = open('mylogin.txt', 'w')f.write(json.dumps(login))f.close
I can log in with curl, but not with Python. No response, just shuts down the connection, I have tried with both requests and httpx.
Any idea?
thanks
POST /rest/v7/login-sessions HTTP/1.1Host: x.x.x.xAccept: */*Accept-Encoding: gzip, deflateConnection: keep-aliveUser-Agent: python-httpx/0.16.1Content-Length: 48Content-Type: application/json{"userName": "manager", "password": "x"}
------------------------------
J.
------------------------------