pysimpleSOAP响应仅包含调用的一部分

时间:2016-10-31 19:59:42

标签: python xml soap pysimplesoap

我无法找到在响应变量中接收整个响应的方法。

此代码的目的是访问市场的Web服务并获取具有特定状态的所有订单,然后解析响应以获取我想要的信息并在csv文件中输出

这是我的代码:

from pysimplesoap.client import SoapClient
import logging
import csv
logging.getLogger().setLevel(logging.DEBUG)
import base64

import xml.etree.ElementTree as ET
import datetime


token = "xxxxxxxxxxxxxxxxxxxxxx"
client = SoapClient(wsdl="https://wsvc.cdiscount.com/MarketplaceAPIService.svc?wsdl", trace = True)
response = client.GetOrderList(headerMessage={'Context': {'CatalogID': 1, 'CustomerPoolID': 1, 'SiteID': 100},
                                             'Localization': {'Country':"Fr",'Currency': "Eur", 'DecimalPosition': 2, 'Language': "Fr"},
                                             'Security':{'DomainRightsList': "", 'IssuerID': "", 'SessionID': "", 'TokenId': token, 'UserName': ""},'Version':1.0},
                              orderFilter={"FetchOrderLines":1,'BeginCreationDate': datetime.datetime(2016,10,29,23,59,59),'EndCreationDate': datetime.datetime(2016,10,30,23,59,59),'States':{'OrderStateEnum':'WaitingForShipmentAcceptation'}})
print response
response_str = str(response)
print(response_str)

我的问题,当我想看到响应时,我只得到预期响应的一部分,而我在调试模式上看到预期的整个响应。

正如您在调试日志中看到的,我们可以看到所有订单。调试模式开始如下:(因为它太长而被切断)

DEBUG:pysimplesoap.client:<s:envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
    <s:body>
        <getorderlistresponse xmlns="http://www.cdiscount.com">
            <getorderlistresult xmlns:i="http://www.w3.org/2001/XMLSchema-instance"><errormessage
                xmlns="http://schemas.datacontract.org/2004/07/Cdiscount.Framework.Core.Communication.Messages"/>
                <operationsuccess
                    xmlns="http://schemas.datacontract.org/2004/07/Cdiscount.Framework.Core.Communication.Messages">true</operationsuccess><errorlist/>
                <sellerlogin>XXXXXXXXXXXX</sellerlogin>
                <tokenid>XXXXXXXXXXXXXXXXXXX</tokenid>
                <orderlist>
                    <order>
                        <archiveparcellist>false</archiveparcellist>
                        <billingaddress><address1 i:nil="true"/><address2 i:nil="true"/><apartmentnumber/><building/>
                            <city>XXXXXXX</city>
                            <civility>MR</civility>
                            <companyname>XXXXXXX</companyname>
                            <country>FR</country>
                            <county>N/A</county>
                            <firstname>XXXXXXX</firstname><instructions/>
                            <lastname>XXXXXXX</lastname><placename/><relayid i:nil="true"/>
                            <street>XXXXXXX</street>
                            <zipcode>XXXXXXX</zipcode>
                        </billingaddress>
                        etc etc etc

回复打印是:

{'GetOrderListResult': {'SellerLogin': u'xxxxxxxxx', 'OperationSuccess': True, 'TokenId': u'xxxxxxxxxxxxxxxxxxxxxxxx', 'OrderList': {'Order': {'VisaCegid': 220, 'ShippedTotalAmount': Decimal('0'), 'PartnerOrderRef': None, 'Corporation': {'CorporationName': u'Cdiscount', etc etc etc

在我发表这篇文章之前,我很快就读了很多帖子,特别是在SO上 谢谢你的帮助。

0 个答案:

没有答案