示例#1
0
 def test_many_authors(self):
     client = GoodreadsClient(apikey.key, apikey.secret)
     client.authenticate(apikey.oauth_access_token,
                         apikey.oauth_access_token_secret)
     book = client.book('18774683')
     assert len(book.authors) == 2
     assert isinstance(book.authors[0], GoodreadsAuthor)
示例#2
0
def create_book(book_id, rating=None):
    resp = GoodreadsClient.book(book_id)

    book = BookSchema().load(resp)
    book.save()

    resp_author = resp["authors"]["author"]
    if type(resp_author) != list:
        resp_author = [resp_author]

    for author in resp_author:
        a = AuthorSchema().load(author)
        a.save()
        book.authors.add(a)

    book.series = try_get_series(resp["work"][0]["id"])
    book.series.save()

    resp_publisher = resp["publisher"]
    if resp_publisher:
        (pub, created) = Publisher.objects.get_or_create(name=resp_publisher)
        book.publisher = pub

    if rating is not None and rating != 0:
        book.rating = rating

    book.save()
示例#3
0
 def setup_class(cls):
     client = GoodreadsClient(apikey.key, apikey.secret)
     client.authenticate(apikey.oauth_access_token,
                         apikey.oauth_access_token_secret)
     cls.book = client.book('11870085')
示例#4
0
 def setup_class(cls):
     client = GoodreadsClient(apikey.key, apikey.secret)
     client.authenticate(apikey.oauth_access_token,
                         apikey.oauth_access_token_secret)
     cls.book = client.book('11870085')
示例#5
0
 def setup_class(cls):
     client = GoodreadsClient('nTRaECtlyOjSmjJnLKRaiw', 'hCXp9GKlAe3sk1QIj0jXLF4UGLt9vfj54hDAfzHY')
     #client.authenticate(apikey.oauth_access_token,
      #                   apikey.oauth_access_token_secret)
     cls.book = client.book('11870085')