Reputation: 11
I use Python code to make a shortcut in a drive folder to another folder (let's call it 'folder X'). This works perfect until suddenly I get the message: 'googleapiclient.errors.HttpError: <HttpError 403 when requesting https://www.googleapis.com/drive/v3/files?alt=json returned "Forbidden". Details: "[{'message': 'Forbidden', 'domain': 'global', 'reason': 'forbidden'}]">'. I have no idea why I get this forbidden message on a previously working JSON auth key file for my service account.
Does anyone have an idea? And how can I get access again to folder X with my JSON auth key file from my service account?
The workaround is that I copy 'folder X' and just make a new 'folder X' in my Google drive, and then it works again. But this is not a sustainable solution.
def Functie_Maak_Snelkoppeling(snelkoppeling_map, listing_map, shortcut_name):
creds = service_account.Credentials.from_service_account_file('C:/.../creds.json')
service = build('drive', 'v3', credentials=creds)
file_metadata = {
'name': shortcut_name,
'mimeType': 'application/vnd.google-apps.shortcut',
'parents': [listing_map],
'shortcutDetails': {
'targetId': snelkoppeling_map
}
}
service.files().create(body=file_metadata).execute()
Upvotes: 0
Views: 40
Reputation: 1
Possible Issue:
Since you said it works for a while then suddenly stops, I think the issue is that you hit the limit of creating 500 shortcuts for one file/folder per account.
Possible Solutions:
I can't think of an elegant solution to it, so you either have to:
Upvotes: 0