I have the following goodreads response:
<GoodreadsResponse>
<Request>
</Request>
<book>
<popular_shelves>
<shelf name="test" other="1"/>
<shelf name="test2" other="2"/>
</popular_shelves/>
</book>
</GoodreadsResponse>
I want to retrieve the popular_shelves 2nd shelf item. (index 1).
Attempt 1:
from xml.etree import ElementTree as ET
root = ET.parse(urllib.urlopen(baseEndpoint+bookName)).getroot()
for atype in root.findall('book/popular_shelves'):
print(atype.get('shelf'))
Attempt 2:
genre = root.find('book').findall('popular_shelves')[0].findall('shelf')
print genre[0].text