I use ZABBIX API to get all hosts.but the respone is null
As following is my code:
please help me
As following is my code:
PHP Code:
import urllib3
import json
Zabbix_Cusor = urllib3.PoolManager()
Zabbix_username = 'Admin'
Zabbix_pass = 'zabbix'
Zabbix_header = {"Content-Type":"application/json"}
Get_Hosts = json.dumps({
"jsonrpc": "2.0",
"method": "host.get",
"params": {
"output": "extend",
},
})
b = Zabbix_Cusor.request('POST',
Zabbix_url,
body=Get_Hosts,
headers=Zabbix_header)
try:
User_Data = json.loads(b.data)['result']
for i in User_Data:
print(i, "\n")
except TypeError:
print("No respone")
Comment