sefakilic / goodreads

:snake: Python wrapper for Goodreads API :books:
262 stars 100 forks source link

Shelves is not working #26

Closed ChillarAnand closed 7 years ago

ChillarAnand commented 8 years ago
import os

from goodreads import client

gr_key = os.environ.get('GR_KEY')
gr_secret = os.environ.get('GR_SECRET')
gc = client.GoodreadsClient(gr_key, gr_secret)
user = gc.user(9669859)
print(user.shelves())

This throws

→ py good_reads.py
Traceback (most recent call last):
  File "good_reads.py", line 10, in <module>
    print(user.shelves())
  File "/home/chillaranand/.virtualenvs/p35/lib/python3.5/site-packages/goodreads/shelf.py", line 7, in __repr__
    return self.name
  File "/home/chillaranand/.virtualenvs/p35/lib/python3.5/site-packages/goodreads/shelf.py", line 11, in name
    return self._shelf_dict['@name']
KeyError: '@name'
tatianass commented 7 years ago

I solved it removing the @name and @count.

ChillarAnand commented 7 years ago

Thanks @tatianass

tatianass commented 7 years ago

You're welcome. :)