1

I'm having trouble to find a way to receive the whole response inside the response variable.

The purpose of this code is to acces throught a webservice of a marketplace and get all order with a particuliar status then parse the response for the information I want and output inside a csv file

Here is my code:

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)

My problem when i want to see the response i got only a part the expected response, while I see on debug mode the whole response expected.

As you can see on the debug log we can see all orders. The debug mode start like this: ( i cutted because it's too long)

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

And the response print is:

{'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

Obvisouly i read lot a post before i make this post, especially on SO Thanks for you help.

Andronaute
  • 379
  • 3
  • 12

0 Answers0