I can do this Curl:
curl -X POST -k --header 'Content-Type: application/json' --header 'Accept: application/json' -d '{"grant_type":"password","username":"admin","password":"admin"}' 'https://<ip_address>/api/fdm/v3/fdm/token'
and get an access token from the firewall API I'm working on. But I'm trying to get it to work in Python using requests:
headers = {
"Content-Type": "application/json",
"Accept": "application/json"
}
payload = {
"grant_type": "password",
"username": "admin",
"password": "admin"
}
r = requests.post('https://<ip_address>/api/fdm/v3/fdm/token', headers=headers, data=payload, verify=False)
and I get a 401 Unauthorized.
I also tried converting my payload to json and doing json=payload in my requests.post but get the same results. What am I doing wrong? Does curl send some default header info I'm not including in my requests?
Thanks!