is there a way to iterate over all items in some album, in google photos? I'm using the google photos provided API, and from what im aware of, I can only get access to 100 media items at a time, using the following:
def create_service(client_secret_file, api_name, api_version, scopes):
print(client_secret_file, api_name, api_version, scopes, sep=', ')
SCOPES = [scope for scope in scopes[0]]
cred = None
pickle_file = f'token_{api_name}_{api_version}.pickle'
if os.path.exists(pickle_file):
with open(pickle_file, 'rb') as token:
cred = pickle.load(token)
if not cred or not cred.valid:
if cred and cred.expired and cred.refresh_token:
cred.refresh(Request())
else:
flow = InstalledAppFlow.from_client_secrets_file(
client_secret_file, SCOPES)
cred = flow.run_local_server()
with open(pickle_file, 'wb') as token:
pickle.dump(cred, token)
service = build(api_name, api_version, credentials=cred)
print(api_name, 'service created successfully')
return service
service = create_service(CLIENT_SECRET_FILE, API_NAME, API_VERSION, SCOPES)
media = service.mediaItems().list(pageSize=MEDIA_TO_SHOW).execute()
where all the upper case are some non relevant string and int constants, that indicate the api's name, the scopes accessible, etc...(for readability). specifically, MEDIA_TO_SHOW = 100
thanks for the help