我一直在尝试通过 Zendesk API 检索我的代理的回复时间数据。但是,每次我使用给定的指标“reply_time_in_minutes”时,我都会得到一个 KeyError。有人对我应该做什么有建议吗?
import requests
# Set the request parameters
url = 'https://domain.zendesk.com/api/v2/incremental/tickets.json?
start_time=1563230494'
user = 'email' + '/token'
pwd = 'token'
# Do the HTTP get request
response = requests.get(url, auth=(user, pwd))
# Check for HTTP codes other than 200
if response.status_code != 200:
print('Status:', response.status_code, 'Problem with the request.
Exiting.')
exit()
# Decode the JSON response into a dictionary and use the data
data = response.json()
ticket_list1 = data['tickets']
for ticket1 in ticket_list1:
print(ticket1['reply_time_in_minutes'])