I have been on this site and cannot find a suitable resolution to this problem.
I can connect to my system via Powershell using the following;
$auth = '{"username":' + '"' + $user + '","password":' + '"' + $Pass + '"}'
$body = $auth
$hdrs = @{}
$hdrs.Add("X-API-KEY", "???")
$r = Invoke-RestMethod -Uri http://$URLSystem/login -Method Post -Body $body -ContentType 'application/json' -Headers $hdrs
I get a response back of 200 and I can get session keys etc...
I have tried a number of things in Python to connect to the same system. I tried this basic approach;
import requests
from requests.auth import HTTPBasicAuth
basic = HTTPBasicAuth('user1','pass1')
r = requests.get("http://URLSystem/login", auth=basic)
print(r.headers)
print(r)
I get a 405 response code. I have tried changing the get to a POST and get a 415 error response.
I am new to Python and having a little difficulty getting this going. Any help would be greatly appreciated.