无法使用assignment_group获取service now票证

2024-06-16 10:54:55 发布

您现在位置:Python中文网/ 问答频道 /正文

我现在无法通过匹配分配组从服务中检索票证。我现在正在使用pysnow和表api从服务中检索票证。在

以下是我的代码:

import pysnow
c = pysnow.Client(instance='myinstance', user='username', password='password')
incident = c.resource(api_path='/table/incident')

#getting the assignment group of a ticket 
print ("tickets are")
response = incident.get(query={'number': 'INC0010020'}, stream=True)
a = response['assignment_group']
print (a)

#using the same assigment group above to fetch more tickets
response = incident.get(query={'assignment_group' : a}, stream=True)
print (response.one())

我得到以下结果:

enter image description here


Tags: theapitruestreamgetresponsegrouppassword
2条回答

尝试在第2行后添加以下内容:

c.parameters.exclude_reference_link = True

“a”变量是一个JSON对象。尝试使用.value 在使用回答时也要注意。您可能需要使用JSON.parse如果响应以字符串形式出现

相关问题 更多 >