I am trying to display 48 books (small cover image and title without title link) using Views Fluid Grid (7.x-3.0). Some of the items (and not always the same after a cache refresh) do not display the cover image. In addition I get the message "Googlebooks: Could not retrieve data from google.com. Forbidden". I replaced titles with ISBNs but the issue remains (ie cover not rendered, error message).

Can somebody help me track down and fix this problem please? TIA.

Comments

darrell_ulm’s picture

Hi @txtualtrail,

Thanks for reporting this.

I've been looking up on the Google Books API and I'm fairly certain one of these things is happening.

  • maximum requests made
  • google books api key is required

Here:
http://superpowerplanet.com/content/drupal-google-book-filter-module
there are 3 books loading, but not 40. I'm guessing that the lack of an API field in the module is what is causing it and what is needed to have a larger number than a few requests made per minute / hour/ etc.

I was under the impression that as long as the data was public, that Google Books would always return data without a key, however I don't think this is the case.

So requests need to be like:

GET https://www.googleapis.com/books/v1/volumes?q=pride+prejudice&download=epub&key=yourAPIKey

The call to the API:

$bib = google_books_api_get_google_books_data($search_string, 0);

is not passing in an API key anywhere.

So what needs to be done (probably)

I'm taking a guess here, but you may have found something where they have stronger requirements to use the API.

Thank you,

Anonymous’s picture

@darrellulm

thanks for your quick response (and great module)!
I will dig into your suggested solutions and report back.

Cheers!

darrell_ulm’s picture

Thanks @txtualtrail, also there are things that would be nice to expand and improve as well. I'm looking into some of these areas, and please post back if/when you learn anything.

There appears to be an API limit (with a valid key) of 1000 per day, and the API Key can be created setup at: https://code.google.com/apis/console

Need to create a key for the Books API

then click on Quotas and will see:

Courtesy Limit

  • Per-User Limit: 1.0 requests/second/user
  • Used: 0%
  • Courtesy Limit: 1,000 requests/day
  • Link: Request more...
  • Link: Set per-user limits...

If the per user limit Request More link is clicked, a new form to request more usage reads:
"Description: Please provide a description of your API usage."

I'm guessing that Google would be friendly to non-profit organizations for larger requests.

First we need to get that API Key into the module.

Thanks again,

darrell_ulm’s picture

Status: Active » Needs review

Hello, I added an API Key to the module, the development head currently, which can be received at:
http://drupal.org/node/1372154/git-instructions/7.x-1.x/nonmaintainer
if you can pull it over with git.

This fix is working with the API Key at:
https://code.google.com/apis/console
and what could be helpful, is in the report tab, you can see how many out of the 1000 daily books you have used up.

Important: every time the cache is cleared, all 40 (or however many) books will try to re-load which will count against the daily limit for 1000, which can be extended if Google OK's the request. Otherwise, I would be careful clearing the cache as the books will need to slowly load back in.

If you (or anybody) can test the development git version at:
http://drupal.org/node/1372154/git-instructions/7.x-1.x/nonmaintainer
you can use the command: git clone --recursive --branch 7.x-1.x http://git.drupal.org/project/google_books.git
if you have git installed, we can get this tested, and I'll make a dev-release.

Thanks again @txtualtrail

Anonymous’s picture

Hi @darrellulm,
tested the development git version - I created 1 node containing 80 titles, using title, author, cover (medium), worldcat link, description, categories, average rating, and "Is Available" on a fresh Bitnami 7.20 install with default theme using [google_books: search string | worldcat] as shortcode. Your changes work like a charm. Thank you!

RE: caching - thanks for pointing this out!

Sincerely,

darrell_ulm’s picture

Also made a dev release last night at the main page http://drupal.org/project/google_books and it has showed up.

(Just scroll down) 7.x-1.x-dev

If after running this for a while and it seems stable, please anyone post and let us know, and I'll make a 7.x-2.0 release before adding any of the new dev changes. Probably it should have always had the API key in there, but apparently Google allows usage without for a limited test number of requests.

Thanks for the feedback!

darrell_ulm’s picture

Status: Needs review » Fixed

This has been working and no complaints, so I'm going to close this one out.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

darrell_ulm’s picture

Assigned: Unassigned » darrell_ulm
Issue summary: View changes
Status: Closed (fixed) » Needs work

Getting an error here, so something may have changed with Google's API Key interface.

Looking into this.

darrell_ulm’s picture

Version: 7.x-1.0 » 7.x-2.0
Status: Needs work » Fixed

It's working, Google's API interface changed. Tested an API Key and it worked, showing hits, and quota.

Fixed in 7.x-2.0 release.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.