python - 无法在 Zeep 中过滤数据
问题描述
我正在使用 Python(Zeep) 从 salesforce 营销云 SOAP API 中提取数据。我能够连接并从中提取数据,但是我无法对其应用过滤器。谁能告诉我我在这里做错了什么?这是我要执行的代码:
from zeep import wsdl
from zeep.wsse.username import UsernameToken
from zeep import Client
client =Client("https://xxxx.soap.marketingcloudapis.com/etframework.wsdl",wsse=UsernameToken('username', 'password'))
requestDictionary = {
"ObjectType": 'DataExtensionObject[xxx_WEB_FORM_DE]',
"Properties": ['FirstName','LastName','LastModifiedDate'],
"Filter": {'Property' : 'LastModifiedDate','SimpleOperator' : 'greaterThan','Value': '9/13/2020 6:37:00 PM'}
}
response = client.service.Retrieve(RetrieveRequest=requestDictionary)
print(response)
-------------------------------------------------
Output:
**TypeError: {http://exacttarget.com/wsdl/partnerAPI}FilterPart() got an unexpected keyword argument 'Value'. Signature:**
xml 看起来像这样:
<sequence>
...
<element name="ObjectType" type="xsd:string" minOccurs="1" maxOccurs="1"/>
<element name="Properties" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
<element name="Filter" type="tns:FilterPart" minOccurs="0" maxOccurs="1"/>
...
</sequence>
</complexType>
和
<complexType name="FilterPart"/>
<complexType name="SimpleFilterPart">
<complexContent>
<extension base="tns:FilterPart">
<sequence>
<element name="Property" type="xsd:string" minOccurs="1" maxOccurs="1"/>
<element name="SimpleOperator" type="tns:SimpleOperators" minOccurs="1" maxOccurs="1"/>
<element name="Value" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
<element name="DateValue" type="xsd:dateTime" minOccurs="0" maxOccurs="unbounded"/>
</sequence>
</extension>
</complexContent>
</complexType>
<complexType name="TagFilterPart">
简单运算符:
<simpleType name="SimpleOperators">
<restriction base="xsd:string">
...
<enumeration value="notEquals"/>
<enumeration value="greaterThan"/>
<enumeration value="lessThan"/>
...
</restriction>
</simpleType>
解决方案
推荐阅读
- vb.net - 将 StartIndex 调暗为整数 Step
- nginx - nginx 中 $request_length 的单位是什么?
- tmux - tmux - 如何使用特殊标记来指示特定的窗口和/或窗格
- javascript - 重新分配输入字段,使用 JQuery 和 JavaScript 的简单计算器
- sql - SQL:使用 OR 进行 Equi 连接
- java - /帮助
有效,实际命令什么也不返回。我的世界 1.14.4 插件 - reactjs - 我在这个 React 应用程序中的待办事项列表没有出现
- mysql - 如何理解 SELECT 和 ORDER BY 的执行顺序
- java - 仅使用 java.lang.reflect 获取所有实现给定接口的类
- c# - 使用面向方面编程防止 IDOR 攻击