12

I've uploaded about 40k photos using the Google Photos uploader tool, and now I'm trying to get a list of those photos using the Picasa Web Albums Data API (as there is no separate Google Photos API that I'm aware of).

So far, it appears impossible to get a complete list of all of the photos because you can list only 1000 photos at a time and then use the start-index parameter to do paging, but the server returns an error once you use a start-index above 11000. With a start-index of 11000 this occurs:

gdata.photos.service.GooglePhotosException: (500, 'Internal Server Error', 'Deprecated offset is too large for a stream ID query. Please switch to using resume tokens.')

(I'm using Python, but have confirmed that the error is independent of the language library)

I'd be happy to switch to using "resume tokens" like the error indicates... except that they are not mentioned in any documentation that I could find.

This is an authenticated request and the URL I'm using looks like this:

https://picasaweb.google.com/data/feed/api/user/[myUserID]/albumid/[myAlbumID]?kind=photo&max-results=1000&start-index=11000

Can anyone show me an example request using resume tokens or point me to documentation on them? Or, if anyone knows of some other way to get a complete list of all of the photos in a large album, that'd be great too. Thanks!

EDIT: the problem happens in any language, but in Python you can reproduce it consistently with:

startIndex = 1
while 1:
    print '(fetching more photos)'
    photos = client.GetFeed(ALBUM_URL, limit=1000, start_index=startIndex)
    for photo in photos.entry:
        print 'startIndex:', startIndex
        startIndex += 1

where ALBUM_URL is like the URL I listed above and client is an authenticated instance of gdata.photos.service.PhotosService.

Dave Brueck
  • 121
  • 5
  • Do you have any code to share? – Youn Elan Jan 08 '17 at 03:15
  • Added, although the URL is highly user- and album-specific, and the code for getting an authenticated client depends on how the app is configured with Google and also requires you download and set up credentials, so I omitted all of that. – Dave Brueck Jan 08 '17 at 04:43
  • Just run in to this myself. The error message is truly bizarre. What on earth is a "stream ID query"? I can't see any reference to this anywhere else. And look at the second sentence, it reads `Please switch to using resume tokens.`, two spaces between "Please" and "switch". It's as though the wrong message accidentally got pasted in. – funkybro Mar 27 '17 at 16:44
  • Dave, did you find a way to overcome this? I am facing the same problem right now. – Alex Benfica Jun 07 '18 at 17:13
  • No, it turns out that the Picasa API is broken in this way and in several others. However in the past few weeks it looks like Google released a new Photos API. Haven't tried it out yet, but maybe it works. See https://developers.google.com/photos/ for details. – Dave Brueck Jun 07 '18 at 23:26
  • Do you know if I have to ask for user authorization again? Or the authorization granted before for Picasa will also work with Google Photos? – Alex Benfica Sep 29 '18 at 21:06

0 Answers0