0

I am using the following example code to fetch details. And it's giving error:

amazonproduct.errors.InvalidClientTokenId: InvalidClientTokenId: The AWS Access Key Id you provided does not exist in our records.

The same is working while I used in PHP. I generated the key going to IAM Console.

access_key = '***'
secret_key = '***'
associate_tag = 'ptab-20'
api = API(locale='us')
    result = api.item_lookup('B006H3MIV8')
    for item in result.Items.Item:
        print '%s (%s)' % (item.ItemAttributes.Title, item.ASIN)
7
  • newbie lesson #1: don't put live keys/passwords on stackoverflow Commented Mar 14, 2016 at 12:02
  • 1
    Where are you passing your access and secret keys to your API()? Also what is API()? Please dd import statement for API() too. Commented Mar 14, 2016 at 12:14
  • @fire I did it deliberately as often was asked to pass on credentials. Since this keys were going to be removed anyway in a few hours so I posted it. Commented Mar 14, 2016 at 14:51
  • @MuhammadTahir I am trying to follow this: python-amazon-product-api.readthedocs.org/en/latest/… Commented Mar 14, 2016 at 14:52
  • @Volatil3 try api = API(AWS_KEY, SECRET_KEY, "us") instead of putting key and secret in a conf file and see if it works. If it does then it means API is not able to read your conf file somehow. Commented Mar 14, 2016 at 15:08

1 Answer 1

2

Somehow python-amazon-product-api is not considering the config file i.e. ~/.amazon-product-api. Alternatively you can specify your credentials directly when instantiating API object by

api = API(AWS_KEY, SECRET_KEY, "us")
Sign up to request clarification or add additional context in comments.

1 Comment

The problem is, this is now deprecated.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.