【问题标题】:How to filter by __encoded_query using suds?如何使用 suds 按 __encoded_query 过滤?
【发布时间】:2013-08-28 10:43:16
【问题描述】:
如何使用 SUDS api 过滤带有 __encoded_query 的结果?
我有,但是没用:
client = Client(WSDL_URL, username=USERNAME, password=PASSWORD)
records = client.service.getRecords(__limit = 100, __encoded_query='incident_state=3')
【问题讨论】:
标签:
python
django
suds
servicenow
【解决方案1】:
过滤结果的一种方法是使用 __inject:
msg = \
"""<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:ns0="http://www.service-now.com/incident"
xmlns:ns1="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Header/>
<ns1:Body>
<ns0:getRecords>
<ns0:__encoded_query>status=0</ns0:__encoded_query>
</ns0:getRecords>
</ns1:Body>
</SOAP-ENV:Envelope>
"""
records = client.service.getRecords(__inject = {'msg' : msg})