def Get(self, item_id, body, r_id, m_id): api = Call() api.Session = self.Session api.RequestData = """ <?xml version="1.0" encoding="utf-8"?> <AddMemberMessageRTQRequest xmlns="urn:ebay:apis:eBLBaseComponents"> <ItemID>%(itemid)s</ItemID> <MemberMessage> <Body> %(body)s </Body> <DisplayToPublic>true</DisplayToPublic> <EmailCopyToSender>false</EmailCopyToSender> <RecipientID>%(r_id)s</RecipientID> <ParentMessageID>%(m_id)s</ParentMessageID> </MemberMessage> </AddMemberMessageRTQRequest> """ api.RequestData = api.RequestData % { 'itemid': item_id, 'body': body, 'r_id': r_id, 'm_id': m_id, } print("===api.RequestData===>", api.RequestData) responseDOM = api.MakeCall("AddMemberMessageRTQ") xml = responseDOM.toprettyxml() Sender_msg_data = self.getMemmberReply( responseDOM.getElementsByTagName('AddMemberMessageRTQResponse')) print("=============Sender_msg_data======", Sender_msg_data) """ force garbage collection of the DOM object """ responseDOM.unlink() return Sender_msg_data
def Get(self, timeFrom, endtime, msg_id=False): api = Call() api.Session = self.Session if msg_id: msges = '' cnt = 0 l = len(msg_id) / 10 + 1 Sender_msg_data = [] for k in range(l): msges = '' for i in msg_id[cnt:(cnt + 10)]: msges += '<MessageID>' + str(i) + '</MessageID>' api.RequestData = """ <?xml version="1.0" encoding="utf-8"?> <GetMyMessagesRequest xmlns="urn:ebay:apis:eBLBaseComponents"> <DetailLevel>ReturnMessages</DetailLevel> <MessageIDs> %(msges)s </MessageIDs> </GetMyMessagesRequest> """ api.RequestData = api.RequestData % {'msges': msges} cnt = cnt + 10 responseDOM = api.MakeCall("GetMyMessages") data = self.getmyDetails( responseDOM.getElementsByTagName('Messages'), msg_id) Sender_msg_data.extend(data) else: api.RequestData = """ <?xml version="1.0" encoding="utf-8"?> <GetMyMessagesRequest xmlns="urn:ebay:apis:eBLBaseComponents"> <StartTime>2015-06-23T12:34:42.000Z</StartTime> <EndTime>%(etime)s</EndTime> <WarningLevel>High</WarningLevel> <DetailLevel>ReturnHeaders</DetailLevel> </GetMyMessagesRequest> """ api.RequestData = api.RequestData % { 'stime': timeFrom, 'etime': endtime } responseDOM = api.MakeCall("GetMyMessages") Sender_msg_data = self.getmyDetails( responseDOM.getElementsByTagName('Messages'), msg_id) """ force garbage collection of the DOM object """ responseDOM.unlink() return Sender_msg_data
def Get(self, timeFrom, timeTo, pageNo): api = Call() api.Session = self.Session # api.RequestData = """ # <?xml version="1.0" encoding="utf-8"?> # <GetMemberMessagesRequest xmlns="urn:ebay:apis:eBLBaseComponents"> # <RequesterCredentials> # <eBayAuthToken>%(token)s</eBayAuthToken> # </RequesterCredentials> # <WarningLevel>High</WarningLevel> # <MailMessageType>All</MailMessageType> # <MessageStatus>Unanswered</MessageStatus> # <StartCreationTime>%(startTime)s</StartCreationTime> # <EndCreationTime>%(endTime)s</EndCreationTime> # <Pagination> # <EntriesPerPage>200</EntriesPerPage> # <PageNumber>%(pageNo)s</PageNumber> # </Pagination> # </GetMemberMessagesRequest>""" api.RequestData = """ <?xml version="1.0" encoding="utf-8"?> <GetMemberMessagesRequest xmlns="urn:ebay:apis:eBLBaseComponents"> <WarningLevel>High</WarningLevel> <MailMessageType>All</MailMessageType> <MessageStatus>Unanswered</MessageStatus> <StartCreationTime>%(startTime)s</StartCreationTime> <EndCreationTime>%(endTime)s</EndCreationTime> <Pagination> <EntriesPerPage>200</EntriesPerPage> <PageNumber>%(pageNo)s</PageNumber> </Pagination> </GetMemberMessagesRequest>""" api.RequestData = api.RequestData % { 'startTime': timeFrom, 'pageNo': pageNo, 'endTime': timeTo, } print("======api.RequestData======>", api.RequestData) responseDOM = api.MakeCall("getmembermessages") Sender_msg_data = self.getMemberDetails( responseDOM.getElementsByTagName('MemberMessage')) """ force garbage collection of the DOM object """ responseDOM.unlink() return Sender_msg_data