Search code examples
pythonbotoamazon-mws

Amazon mws access denied for european marketplace


I'm trying to pull competetive prices from amazon mws using boto. When I try to do it for US marketplace it works perfectly fine, bun when I try to do it using European endpoint it returns

boto.mws.response.AccessDenied: AccessDenied: Unauthorized Access denied

Here is the code Im using

connect = connection.MWSConnection(aws_access_key_id=access_key,
`                                  aws_secret_access_key=secret_key,
                                    host="mws-eu.amazonservices.com")
connect.SellerId=sellerId
product = connect.get_competitive_pricing_for_asin(ASINList= ["B01HETFQA8"],
                                                  MarketplaceId="A1PA6795UKMFR9")

Again, it works fine for US marketplace. Im registered as a seller in both US and Europe. Im getting marketplace IDs from this page https://docs.developer.amazonservices.com/en_US/dev_guide/DG_Endpoints.html

Any help is greatly appretiated


Solution

  • This questions has already been answered here: Amazon Europe MWS Python Boto Connection AccessDenied.

    But to reiterate, find your connection.py file for boto and at line 269 change:

    kw.setdefault('host', 'mws.amazonservices.com')
    

    to

    kw.setdefault('host', 'mws-eu.amazonservices.com')
    

    By default Boto is routing to Amazon US MWS endpoint mws.amazonservices.com whereas you are looking for the Amazon EU MWS endpoint which is mws-eu.amazonservices.com

    A full list of endpoints for other countries / geographical regions is available here http://docs.developer.amazonservices.com/en_US/dev_guide/DG_Endpoints.html

    You can also see Boto's default connection.py file here: https://github.com/boto/boto/blob/develop/boto/mws/connection.py#L269