Open redtoad opened 8 years ago
Original comment by Josh M. (Bitbucket: macdonjo, GitHub: macdonjo)
Did anyone get it to work? I'm not sure if strings should be in quotes. It uses the Python library, ConfigParser: https://docs.python.org/2/library/configparser.html
I wrote a question here about the format that you guys might find helpful: http://stackoverflow.com/questions/37127587/what-format-should-the-file-for-configparser-be
I read the source code for the API class and looked at the constructor. It is:
#!python
def __init__(self, access_key_id=None, secret_access_key=None, locale=None,
associate_tag=None, processor='amazonproduct.processors.objectify',
cfg=None):
So I simply did as the first David said, but the associate ID is not 3rd, it's forth in the constructor, and that worked.
Original comment by David Schlesinger (Bitbucket: david_schlesinger, GitHub: Unknown)
I seem to be running into the same issue. I've got an active Amazon associates account set up to use the API, of the form "shXXXXXXXXXXX-20"; I created a new IAM user with a new access key pair, I've created a .amazon-product-api file which looks like
[Credentials]
access_key=AKIXXXXXXXXXXXXXXXXX
secret_key=2ezxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
associate_tag=shuxxxxxxxxxx-20
However when I try to do a simple test, I get an error that there's no AWS access key in their records. I'm sure I'm missing something boneheaded here, but I've been butting my head against this for a while now.
>>> from amazonproduct import API
>>> api = API(locale='us')
>>> for book in api.item_search('Books', Isbn='9780399161131'):
... print '%s: "%s"' % (book.ItemAttributes.Author, book.ItemAttributes.Title)
...
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/mcfate/Projects/pyglean/venv/lib/python2.7/site-packages/amazonproduct/api.py", line 529, in item_search
return paginator(self.call, **operators)
File "/Users/mcfate/Projects/pyglean/venv/lib/python2.7/site-packages/amazonproduct/processors/__init__.py", line 88, in __init__
self.page(kwargs.get(self.counter, 1))
File "/Users/mcfate/Projects/pyglean/venv/lib/python2.7/site-packages/amazonproduct/processors/__init__.py", line 121, in page
root = self.fun(*self.args, **self.kwargs)
File "/Users/mcfate/Projects/pyglean/venv/lib/python2.7/site-packages/amazonproduct/api.py", line 334, in call
return self._parse(e.fp)
File "/Users/mcfate/Projects/pyglean/venv/lib/python2.7/site-packages/amazonproduct/api.py", line 277, in _parse
raise _e(errors[e.code])
amazonproduct.errors.InvalidClientTokenId: InvalidClientTokenId: The AWS Access Key Id you provided does not exist in our records.
>>>
Any guidance or suggestions would be appreciated, thanks.
Original comment by David . (Bitbucket: david__, GitHub: Unknown)
I am currently encountering the same issue. Try removing the <> brackets and any blank spaces at the beggining and end of the keys. Also try running a script
#!python
from amazon.api import AmazonAPI
amazon = AmazonAPI(AMAZON_ACCESS_KEY, AMAZON_SECRET_KEY, AMAZON_ASSOC_TAG)
replacing the keys as standard to see if it runs from there. There is also a time delay on creating keys and them beginning to work, not long but a small few minute delay.
EDIT: Just fixed mine. Your file should be named .amazon-product-api , no need for .cfg according to the documentation. The File should read line by line too. so:
#!Text
[Credentials]
access_key=AKIAxxxxxxxxxxxxxxxxxxxxx
secret_key=eZa3yvxxxxxxxxxxxxxxxxxxxxxxxxx
associate_tag=p07xxx-xx
Hopefully that helps. I realise I am commenting fairly long after you posted, better late than never.
Originally reported by Anonymous
Hello,
I'm unsure what is causing this - I've tried it with several different several access keys from Amazon. I am signed up for the Product Advertising. The config file is named amazon-product-api.cfg and is located in the folder C:\Users\
The contents of the configuration file are as follows:
[Credentials] access_key =
secret_key =
associate_tag =
Obviously, there aren't actually x's in the config file itself, just placeholders to get the point across
When I execute the sample script, it will return the following error:
raise _e(errors[e.code]) amazonproduct.errors.InvalidClientTokenId: InvalidClientTokenId: The AWS Access Key Id you provided does not exist in our records.
Have any of you encountered this before? Any ideas on resolving this?