I'm writing a program to backup my Google Photos library locally, and last week the code was working fine but in the last few days I've been repeatedly getting an error back from the API client saying that "photoslibrary v1" does not exist within Google's API library. The docs haven't changed at all - is there a problem on Google's end or is it me?
from googleapiclient import discovery
from httplib2 import Http
from oauth2client import file, client, tools
class Photos:
def __init__(self):
self.SCOPE = "https://www.googleapis.com/auth/photoslibrary"
self.CLIENT_SECRET = "client_id.json"
self.store = file.Storage("storage.json")
self.credentials = self.store.get()
if not self.credentials or self.credentials.invalid:
self.flow = client.flow_from_clientsecrets("client_id.json", self.SCOPE)
self.credentials = tools.run_flow(self.flow, self.store)
self.PHOTOS = discovery.build("photoslibrary", "v1", http=self.credentials.authorize(Http()))
photos = Photos()
googleapiclient.errors.UnknownApiNameOrVersion: name: photoslibrary version: v1
Try adding the parameter static_discovery=False
self.PHOTOS = discovery.build("photoslibrary", "v1", http=self.credentials.authorize(Http()),static_discovery=False)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With