python-amazon-sp-api: Request headers are not editable, causing problem with RDT
Orders
To get more information about ShippingAddress and BuyerInfo from getOrders calls we have to pass restricted data token to request headers. Instead of using access token for x-amz-access-token, we need to pass RDT.
As far as I see there is no way to reach request headers to edit it.
My Suggestion
response = Orders(**credentials).get_orders(**params, restricted_data_token="Atz.r|...")
Restricted data token is special for order endpoints. So I believe we can implement a usage like above.
I can work on it and open a pull request next 1 or 2 days.
What do you think?
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 15 (15 by maintainers)
Already It’s really easy from this package but there are lots of things going on in Selling Partner API.
Again, thank you for your time and effort 👍
This was my mistake. There is no problem with getOrders call but getOrderItems call was failing. I think we can’t use RDT for getOrderItems because for getOrders everything works fine.
Yet, from getOrders operation I took empty BuyerInfo. Probably, this is happening because of my application’s roles.
Anyway, I think this solution is perfect.
Can you also have a look if you can download reports like that please? The order-invoice report should contain PII
I have updated the package, you can use the rdt token now by passing it to the client:
https://github.com/saleweaver/python-amazon-sp-api/commit/65210466be94f4f56413a1e9df0061e12e4daa09
Can you please check out 0.7.0 if that works for you? https://github.com/saleweaver/python-amazon-sp-api/releases/tag/v0.7.0
I want to do it for only getOrder, getOrders and getOrderItems calls. Hereby, Amazon will give customer/buyer & shipping address information from getOrders If RDT passed to headers. So, sending request to getBuyerInfo or getOrderAddress will be unnecessary. Also It causes request throttling, that problem will be solved, too.
Currently, I’m migrating our application MWS to SP-API. While doing this, I can make some improvements to this package. Also I’m in touch with Amazon Developer Support about this RDT thing right now. I will update you If I get any useful information.
I’ll be available at this weekend, we can have a call.
==Out of context== And there is a small favour I want you to do 😃
Can you add hacktoberfest label to the issue? There is an event about it, you can get more information from here: https://hacktoberfest.digitalocean.com/
Thanks!