zabbix官网地址:19. API19. APIhttps://www.zabbix.com/documentation/4.2/zh/manual/api
每个版本可以有些差异,选择目前的版本在查看对于的api接口
#token接口代码
import requests
apiurl = "http://zabbix地址/api_jsonrpc.php"
data = {"jsonrpc": "2.0",
"method": "user.login",
"params": {
"user": "493031",
"password": "密码"
},
"id": 1,
"auth": None
}
auth=requests.post(url=apiurl,headers={"Content-Type":"application/json"},json=data)
token = auth.json().get('result')
print(auth.text)
print(token)