Return XML from boto calls



I am using boto 2.32.1 with Python 2.7.6. I am having problems with the list_orders function of boto's mws modules to get the XML data of my Amazon orders.


Here is the call I make:



response = connection.list_orders(CreatedAfter='2014-08-26T05:53:44+00:00',
MarketplaceId=['XXXXXXXXXXXXX'])


Here is the value of response (with personal information removed obviously)



ListOrdersResponse{u'xmlns': u'http://ift.tt/PeLt2L'}
(ListOrdersResult: ListOrdersResult{}
(CreatedBefore: u'2014-08-26T10:06:10Z', Orders: ^Orders^{}
(Order: [Order{}(***ORDER INFORMATION***)])),
ResponseMetadata: ^ResponseMetadata^{}(RequestId: u'xxxxxxxxxx'))


This isn't ideal because I have another module for eBay sales that works with the XML returned by ebaysdk-python. Amazon formats their XML similarly to eBay so if I could get the XML returned by Amazon instead of the format above, it would be brilliant.


I have noticed that if I use boto.set_stream_logger('boto'), it will print the XML returned so maybe I could take advantage of that somehow?


This is what I would like to be returned:



<ListOrdersResponse xmlns="http://ift.tt/PeLt2L">
<ListOrdersResult>
<Orders>
<Order>
***ORDER INFORMATION***
</Order>
</Orders>
<CreatedBefore>2014-08-26T10:18:59Z</CreatedBefore>
</ListOrdersResult>
<ResponseMetadata>
<RequestId>XXXXXXXXXXXXXXXXXXXXXXXXXXXXX</RequestId>
</ResponseMetadata>
</ListOrdersResponse>


I could then use Python's brilliant xml.etree.ElementTree to parse and work with the data.


Any help would be greatly appreciated.


Sorry if I done something wrong, it's my first time posting.


Tiada ulasan:

Catat Ulasan