Description
Apologies if I'm making a noob error, but I can't seem to get browse node to work correctly. I'm a version ahead so that might be the issue but as near as I can tell in my own debugging the call to browse node returns a correct response group and I can see the expected information but in lxml it looks like when the parser is applied something goes awry and I can't figure it out. Here's as much as I can provide.
SAMPLE PROGRAM (I've added the error shown as comments after the call)
from amazon.api import AmazonAPI
AMAZON_ACCESS_KEY = "***"
AMAZON_SECRET_KEY = "***"
AMAZON_ASSOC_TAG = "***"
amazon = AmazonAPI(AMAZON_ACCESS_KEY, AMAZON_SECRET_KEY, AMAZON_ASSOC_TAG)
bn = amazon.browse_node_lookup(BrowseNodeId=1036682)
print(bn.name)
#### WHEN THE BrowseNodeId IS A PARENT
#Traceback (most recent call last):
# File "amazon-product-browse-node.py", line 14, in <module>
# bn = amazon.browse_node_lookup(BrowseNodeId=1036682)
# File "/opt/anaconda3/lib/python3.6/site-packages/amazon/api.py", line 265, in browse_node_lookup
# return [AmazonBrowseNode(node.BrowseNode) for node in root.BrowseNodes]
# File "/opt/anaconda3/lib/python3.6/site-packages/amazon/api.py", line 265, in <listcomp>
# return [AmazonBrowseNode(node.BrowseNode) for node in root.BrowseNodes]
# File "src/lxml/lxml.objectify.pyx", line 229, in lxml.objectify.ObjectifiedElement.__getattr__ (src/lxml/lxml.objectify.c:4279)
# File "src/lxml/lxml.objectify.pyx", line 450, in lxml.objectify._lookupChildOrRaise (src/lxml/lxml.objectify.c:7059)
#AttributeError: no such child: {http://webservices.amazon.com/AWSECommerceService/2013-08-01}BrowseNode
bn = amazon.browse_node_lookup(BrowseNodeId=2619526011)
print(bn.name)
#### WHEN THE BrowseNodeId is a child
#Traceback (most recent call last):
# File "amazon-product-browse-node.py", line 17, in <module>
# print(bn.name)
#AttributeError: 'list' object has no attribute 'name'
My key system attributes:
python -V
Python 3.6.0 :: Anaconda custom (64-bit)
pip freeze (Select subset)
anaconda-navigator==1.5.3
anaconda-project==0.4.1
beautifulsoup4==4.5.3
bottlenose==1.1.2
coverage==4.4.1
coveralls==1.1
Cython==0.25.2
ipython==5.1.0
lxml==3.7.2
nose==1.3.7
pep8==1.7.0
pyparsing==2.1.4
pytest==3.0.5
python-dateutil==2.6.0
see==1.4.0
Sphinx==1.1.3
Let me know if I've missed something and apologies if it is something basic. Also, I do see that this is a version ahead of what was certified. Your help would be appreciated if possible.
Thanks,
-Hayes