Quick and dirty display of Goodreads books from user's shelf.

pull/1/head
Raymond Yee 2011-10-25 16:00:52 -07:00
parent 1aa6dff8f7
commit 2f81b8cebd
1 changed files with 14 additions and 0 deletions

View File

@ -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"]