Open Kottejimmy opened 1 month ago
I don't use this lib but I believe the fix was fairly easy. I have committed a change in #81 that shoud fix it.
@jamesdreid, first of all thanks for the support!
Ive made the changes as you suggested but once i do I get another error:
_2024-11-29 15:28:19,115 fortiosapi DEBUG self._https is True
2024-11-29 15:28:19,115 fortiosapi DEBUG host is XXXXXXX
2024-11-29 15:28:19,115 fortiosapi DEBUG vdom is: global
2024-11-29 15:28:19,116 fortiosapi DEBUG in monitor url is https://XXXXXXX/api/v2/monitor/system/status?global=1
2024-11-29 15:28:19,353 fortiosapi DEBUG in MONITOR function
2024-11-29 15:28:19,354 fortiosapi DEBUG formating response
2024-11-29 15:28:19,354 fortiosapi DEBUG response content type : application/json
2024-11-29 15:28:19,354 fortiosapi DEBUG Request : GET on url : https://xxxxx/api/v2/monitor/system/status?global=1
2024-11-29 15:28:19,355 fortiosapi DEBUG Response : http code 200 reason : OK
2024-11-29 15:28:19,355 fortiosapi DEBUG raw response: b'{\n "http_method":"GET",\n "results":{\n "model_name":"FortiGate",\n "model_number":"70F",\n "model":"FGT70F",\n "hostname":"XXXXXXX",\n "log_disk_status":"notavailable"\n },\n "vdom":"root",\n "path":"system",\n "name":"status",\n "status":"success",\n "serial":"XXXXXXX",\n "version":"v7.4.5",\n "build":2702\n}'
2024-11-29 15:28:19,355 fortiosapi WARNING in formatresponse res.content does not exist, should not occur
2024-11-29 15:28:19,355 fortiosapi DEBUG response system/status : <Response [200]>
Any ideas?
Hi, Ive upgraded some Fortigates from 7.2.10 to 7.4.5.
Im running VDOMs in all the firewalls and using tokenlogin as login method.
7.2.10 works fine but the Firewalls with 7.4.5 has stopped working with the following error: line 266, in tokenlogin self._fortiversion = resp_lic['version'] TypeError: 'Response' object is not subscriptable
In the debug logs Im seeing this: 2024-10-23 15:46:46,965 fortiosapi DEBUG self._https is True 2024-10-23 15:46:46,965 fortiosapi DEBUG host is XXXXXXX 2024-10-23 15:46:46,965 fortiosapi DEBUG vdom is: global 2024-10-23 15:46:46,965 fortiosapi DEBUG urlbuild is https://XXXXXXX/api/v2/cmdb/system/status?global=1 with crsf: {'User-Agent': 'python-requests/2.32.3', 'Accept-Encoding': 'gzip, deflate', 'Accept': '/', 'Connection': 'keep-alive', 'Authorization': 'XXXXXXX'} 2024-10-23 15:46:46,965 fortiosapi DEBUG Calling GET ( https://XXXXXXX/api/v2/cmdb/system/status?global=1, None) 2024-10-23 15:46:47,164 fortiosapi DEBUG in GET function 2024-10-23 15:46:47,165 fortiosapi DEBUG formating response 2024-10-23 15:46:47,165 fortiosapi DEBUG response content type : application/json 2024-10-23 15:46:47,165 fortiosapi DEBUG Request : GET on url : https://XXXXXXX/api/v2/cmdb/system/status?global=1
2024-10-23 15:46:47,165 fortiosapi DEBUG Response : http code 404 reason : Not Found
2024-10-23 15:46:47,165 fortiosapi DEBUG raw response: b'{\n "status":"error",\n "http_status":404,\n "path":"system",\n "name":"status",\n "serial":"XXXXXXX",\n "version":"v7.4.5",\n "build":2702,\n "http_method":"GET"\n}' 2024-10-23 15:46:47,165 fortiosapi WARNING in formatresponse res.content does not exist, should not occur 2024-10-23 15:46:47,165 fortiosapi DEBUG response system/status : <Response [404]>
I believe the issue is caused by a depricated API URL described in the below KB. https://community.fortinet.com/t5/FortiGate/Technical-Tip-API-error-404-after-upgrading-to-7-4-4/ta-p/344457
Could you guys please fix this issue?