Support » Plugin: Photonic Gallery & Lightbox for Flickr, SmugMug, Google Photos & Others » Google photos API quota exceeded when displaying a gallery of albums

  • benoit42

    (@benoit42)


    Hi,

    I’m facing a problem when try to display a gallery of Google Photo albums :

    Here is my problem:
    I wrote a page with a photonic instance configured as this :
    – display multiple albums
    – display selected albums (approx 10-15)
    – Chain request option checked (otherwise I have the problem described here : https://wordpress.org/support/topic/display-old-google-photos-albums/#post-11646110)

    There is only one instance of photonics plugin in my page.
    My Google Photos account has 264 albums.

    Then I launched the page preview. It ran for about 5mins, I stopped it. On my Google console, I see that more than 26000 requests have been sent to google.photos.library.v1.PhotosLibrary.ListAlbums API, since 5 minutes 🙁
    There is not heavy traffic on my site, I’m the only one that can see that page.

    I don’t see what is going wrong… If somebody have some time to help me, I’d be very glad.

    Regards,
    Benoît.

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Sayontan

    (@sayontan)

    I looked at the code, and the only problem I can guess is happening is that a non-existent album id is being passed to the shortcode – it shouldn’t happen if you are using the gallery builder, so that is weird.

    Can you try making a code change to see if it helps?

    If you open wp-content/plugins/photonic/extensions/Photonic_Google_Photos_Processor.php (you can access it from your dashboard under Plugins → Plugin Editor, by selecting Photonic from the dropdown, then navigating to extensions/Photonic_Google_Photos_Processor.php), look at line 548. You will see this:

    if (strtolower($short_code['filter_type']) !== 'exclude' && !empty($filters) && count($processed) < count($filters) && !empty($photonic_google_chain_queries)) {

    Change it to:
    if (!empty($pagination['next-token']) && strtolower($short_code['filter_type']) !== 'exclude' && !empty($filters) && count($processed) < count($filters) && !empty($photonic_google_chain_queries)) {

    Hopefully this will fix the issue.

    benoit42

    (@benoit42)

    Hi Sayontan,
    I did the fix. But have to wait until tomorrow for a new quota 🙂
    Thanks !
    Benoît.

    Hi Sayontan,

    With this fix, I haven’t any Google API overflow anymore.
    But when I’m preview my page, albums after the 50th are not displayed.

    Regards, Benoît.

    Plugin Author Sayontan

    (@sayontan)

    I suspect you might be facing an issue with Google itself.

    Basically what is happening is that Google is probably not returning a nextPageToken for you. To see what I mean, do the following:

    1. Go to https://developers.google.com/photos/library/reference/rest/v1/albums/list
    2. On the right side you might see a section called “Try this API”. If it is not open, click on the button that says “Try it”
    3. In pageSize put in 50, and then click “Execute”
    4. You might have to click through some authentication screens, and then at the bottom you will see the response. Do you see nextPageToken at the bottom?

    If you don’t, then this is a problem with Google and you might have to contact them.

    Hi Sayyontan,
    I have a nextPageToken.

    {
    “albums”: [
    some albums….
    ],
    “nextPageToken”: “CkAKPnR5cGUuZ29vZ2xl…”
    }

    Benoît.

    Plugin Author Sayontan

    (@sayontan)

    Sorry, in that case I don’t know what is going on. The code I made you change simply checks for the presence of the nextPageToken. In your case the when you are running Photonic’s code the nextPageToken is not coming across. That is why:

    1. When you ran the original code the pages were running in an infinite loop
    2. When you changed the code, the pages found no nextPageToken and stopped running after the first query (which is why you are only seeing results from the first page).

    Can you paste out the shortcode that is being generated?

Viewing 6 replies - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.