最近,我开始学习 Python。我计划为我们公司构建一个程序来管理来自所有亚马逊市场网站、我们自己的 Bigcommerce 商店和 eBay 的订单。
现在我可以使用 Boto 库成功向 Amazon US、Amazon Canada 和 Amazon Mexico 发送请求并获取所有订单信息。(Boto 是我能找到的唯一一个与亚马逊 MWS 完美配合的库)但是当我使用相同的方法向 Amazon.co.uk 发送请求时,它失败了。这是我用来发送请求的示例代码。
from boto.mws.connection import MWSConnection
MarketPlaceID = marketplaceid
MerchantID = merchantid
AccessKeyID = accesskeyid
SecretKey = secretkey
mws = MWSConnection(AccessKeyID,SecretKey)
mws.SellerId = MerchantID
mws.Merchant = MerchantID
mws.MarketplaceId = MarketPlaceID
orderstatus = ['PartiallyShipped','Unshipped', 'Shipped']
orders=mws.list_orders(LastUpdatedAfter = '2016-05-01T17:00:00Z', MarketplaceId = [MarketPlaceID],OrderStatus=orderstatus)
此代码非常适用于我们在亚马逊加拿大、亚马逊美国和亚马逊墨西哥的商店。但是当我将它用于 Amazon.co.uk. 时,我总是得到这些 AccessDenied 代码。(我 100% 确认所有的 marketplaceid、sellersid、accesskeyid 和 secretkeyid 都是正确的。)
AccessDenied
Traceback (most recent call last):
File "C:\Python\Amazon Test.py", line 17, in <module>
orders=mws.list_orders(LastUpdatedAfter='2016-05-01T17:00:00Z', MarketplaceId = [MarketPlaceID],OrderStatus=orderstatus)
File "C:\Users\Yinghao\AppData\Local\Programs\Python\Python35-32\lib\site-packages\boto\mws\connection.py", line 158, in requires
return func(*args, **kw)
File "C:\Users\Yinghao\AppData\Local\Programs\Python\Python35-32\lib\site-packages\boto\mws\connection.py", line 158, in requires
return func(*args, **kw)
File "C:\Users\Yinghao\AppData\Local\Programs\Python\Python35-32\lib\site-packages\boto\mws\connection.py", line 177, in wrapper
return func(*args, **kw)
File "C:\Users\Yinghao\AppData\Local\Programs\Python\Python35-32\lib\site-packages\boto\mws\connection.py", line 196, in wrapper
return func(*args, **kw)
File "C:\Users\Yinghao\AppData\Local\Programs\Python\Python35-32\lib\site-packages\boto\mws\connection.py", line 177, in wrapper
return func(*args, **kw)
File "C:\Users\Yinghao\AppData\Local\Programs\Python\Python35-32\lib\site-packages\boto\mws\connection.py", line 196, in wrapper
return func(*args, **kw)
File "C:\Users\Yinghao\AppData\Local\Programs\Python\Python35-32\lib\site-packages\boto\mws\connection.py", line 177, in wrapper
return func(*args, **kw)
File "C:\Users\Yinghao\AppData\Local\Programs\Python\Python35-32\lib\site-packages\boto\mws\connection.py", line 139, in wrapper
return func(*args, **kw)
File "C:\Users\Yinghao\AppData\Local\Programs\Python\Python35-32\lib\site-packages\boto\mws\connection.py", line 81, in wrapper
return func(self, *args, **kw)
File "C:\Users\Yinghao\AppData\Local\Programs\Python\Python35-32\lib\site-packages\boto\mws\connection.py", line 252, in wrapper
return func(self, request, response, *args, **kw)
File "C:\Users\Yinghao\AppData\Local\Programs\Python\Python35-32\lib\site-packages\boto\mws\connection.py", line 732, in list_orders
return self._post_request(request, kw, response)
File "C:\Users\Yinghao\AppData\Local\Programs\Python\Python35-32\lib\site-packages\boto\mws\connection.py", line 323, in _post_request
response.reason, body)
boto.mws.response.ResponseFactory.element_factory.<locals>.DynamicElement: AccessDenied: Unauthorized
Access denied
谁能告诉我如何通过 Python Boto 库或其他 Python 库提出连接到 Amazon.co.uk 的请求?任何帮助将不胜感激。
谢谢