GithubHelp home page GithubHelp logo

dreadpirateshawn / goodreads Goto Github PK

View Code? Open in Web Editor NEW

This project forked from sefakilic/goodreads

0.0 0.0 0.0 107 KB

:snake: Python wrapper for Goodreads API :books:

Python 98.31% Dockerfile 1.69%

goodreads's People

Contributors

bcipriano avatar dreadpirateshawn avatar mcrapet avatar sefakilic avatar tatianass avatar varzan avatar

Watchers

 avatar  avatar

goodreads's Issues

Reviews are returned as single dict rather than list if only one is present in a shelf

When a shelf contains only a single item (or for instance the last page of a shelf does), then it's returned as a single dict rather than a list of dicts.

Example URL (although this will undoubtedly stop repro'ing as content changes):
https://www.goodreads.com/review/list/18761398.xml?v=2&page=3&shelf=3-star

This is ultimately an xml issue, since the spec does not disambiguate "always single child" vs "list that happens to be a single item". See martinblech/xmltodict#14 for discussion, and see https://stackoverflow.com/a/39068400/128977 for a workaround in newer xmltodict versions.

Feature request: expose "date_added" for reviews

Sample api data:

<reviews start="41" end="60" total="587">
  <review>
    ...
    <date_added>Thu Apr 04 19:28:50 -0700 2019</date_added>
    ...
  </review>

Desired method: date_added

Return value: datetime object

Use-case: Determining which books have been on my to-read shelf the longest.

book.gid sometimes returns ordereddict rather than id

From some vectors, the book data presents the gid as text, whereas other vectors returns the book data as an OrderedDict.

>>> from goodreads import client
>>> gc = client.GoodreadsClient("...", "...")
>>> books = gc.shelf("18761398", 'to-read')
>>> books[0].gid
OrderedDict([('@type', 'integer'), ('#text', '25109947')])
>>> book = gc.book(25109947)
>>> book.gid
'25109947'

tests: unclear run steps, difficult to debug, many missing asserts

Unclear run steps:
Add makefile or similar for tests, perhaps they use pytest?

Difficult to debug:
Actual value isn't reported by asserts, simply that it doesn't match expected value, e.g.

FAIL: tests.author_test.TestAuthor.test_gender
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/nose/case.py", line 198, in runTest
    self.test(*self.arg)
  File "/goodreads/tests/author_test.py", line 36, in test_gender
    assert self.author.gender == 'malt'
AssertionError

Many missing asserts:
Various tests can never fail because they don't actually assert anything, e.g.

    def test_born_at(self):
        self.author.born_at == '1938/01/10'

book.popular_shelves and book.series_works can be empty

Example of both cases:

OrderedDict([
  ('id', OrderedDict([
    ('@type', 'integer'),
    ('#text', '546454')])),
    ('isbn', '0532601467'),
    ('isbn13', '9780532601463'),
    ('text_reviews_count', OrderedDict([('@type', 'integer'), ('#text', '98')])),
    ('uri', 'kca://book/amzn1.gr.book.v1.nc7d34Wasx0hXPwjH9DMLQ'),
    ('title', 'The Voyage of the Space Beagle'),
    ('title_without_series', 'The Voyage of the Space Beagle'),
    ('image_url', 'https://s.gr-assets.com/assets/nophoto/book/111x148-bcc042a9c91a29c1d680899eff700a03.png'),
    ('small_image_url', 'https://s.gr-assets.com/assets/nophoto/book/50x75-a91bf249278a81aabab721ef782c4a74.png'),
    ('large_image_url', None),
    ('link', 'https://www.goodreads.com/book/show/546454.The_Voyage_of_the_Space_Beagle'),
    ('num_pages', '192'),
    ('format', 'Paperback'),
    ('edition_information', None),
    ('publisher', 'Macfadden-Bartell'),
    ('publication_day', None),
    ('publication_year', '1963'),
    ('publication_month', None),
    ('average_rating', '3.86'),
    ('ratings_count', '3137'),
    ('description', None),
    ('authors', OrderedDict([
      ('author', OrderedDict([
        ('id', '1293688'),
        ('name', 'A.E. van Vogt'),
        ('role', None),
        ('image_url', OrderedDict([
          ('@nophoto', 'false'),
          ('#text', 'https://images.gr-assets.com/authors/1226200601p5/1293688.jpg')
        ])),
        ('small_image_url', OrderedDict([
          ('@nophoto', 'false'),
          ('#text', 'https://images.gr-assets.com/authors/1226200601p2/1293688.jpg')
        ])),
        ('link', 'https://www.goodreads.com/author/show/1293688.A_E_van_Vogt'),
        ('average_rating', '3.84'),
        ('ratings_count', '38578'),
        ('text_reviews_count', '2280')
      ]))
    ])),
    ('published', '1963'),
    ('work', OrderedDict([('id', '2016616'), ('uri', 'kca://work/amzn1.gr.work.v1.3tDylDehuKu4BaHTdlO5Ow')]))
  ])

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.