Fortigate API Request python
Hi,
I am struggeling with API requests to a Fortigate (Version 7.0.15). I used instructions from FNDN and got curl requests working as expected but the same request in python just throws a 401.
The python code:
url = 'https://fortigate/api/v2/cmdb/firewall/policy/?vdom=vdom‘ request_headers = {'Content-Type': 'application/json', 'Authorization': 'Bearer <apikey>‘ } response = requests.get(url, headers=request_headers)
The same (working) request in curl:
curl -s -H "Accept: application/json" -H "Authorization: Bearer <apikey>“ https://fortigate/api/v2/cmdb/firewall/policy/?vdom=vdom
Anyone has an idea what's wrong with the python request?
