无法使用assignment_group获取现在的服务票证

问题描述 投票:1回答:2

我现在无法通过匹配assignment_group来检索服务中的票证。我正在使用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

python servicenow servicenow-rest-api
2个回答
0
投票

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

c.parameters.exclude_reference_link = True

0
投票

你的'a'变量是一个JSON对象。尝试使用a.value在使用回复时也要注意。如果响应以字符串形式出现,则可能需要使用JSON.parse

© www.soinside.com 2019 - 2024. All rights reserved.