Quick and dirty display of Goodreads books from user's shelf.
parent
1aa6dff8f7
commit
2f81b8cebd
|
@ -0,0 +1,14 @@
|
|||
from django.core.management.base import BaseCommand
|
||||
from regluit.core.goodreads import GoodreadsClient
|
||||
from django.conf import settings
|
||||
from itertools import islice
|
||||
|
||||
class Command(BaseCommand):
|
||||
help = "list books on given user bookshelf"
|
||||
args = "<user_id shelf_name max_books>"
|
||||
|
||||
def handle(self, user_id, shelf_name, max_books, **options):
|
||||
max_books = int(max_books)
|
||||
gc = GoodreadsClient(key=settings.GOODREADS_API_KEY, secret=settings.GOODREADS_API_SECRET)
|
||||
for (i, review) in enumerate(islice(gc.review_list(user_id,shelf=shelf_name),max_books)):
|
||||
print i, review["book"]["title"], review["book"]["small_image_url"]
|
Loading…
Reference in New Issue