I am testing my script that uses PyDrive to upload to a folder inside a shared drive. As it is, the files upload with no problem, however, the sharable link doesn't work. My program hits my exception block by then. I don't receive any errors.
file1 = drive.CreateFile(metadata={"title": "{0}_Index1.html".format(formatDate), 'mimeType':'text/html', "parents": [{ "kind": 'drive#fileLink', 'myteamDriveId': sharedDriveId, "id": myIdGoesHere }]})
file1.SetContentFile(fileName) # Set content of the file from given string.
file1.Upload(param={'supportsTeamDrives': True})
**# The script prints all output to here no issues. From the code below, it stops working.**
permission = file1.InsertPermission({
'type': 'anyone',
'value': 'anyone',
'role': 'reader'})
# SHARABLE LINK
link = file1['alternateLink']
Any suggestions?
Update: done some digging and this is the error:
<HttpError 404 when requesting https://www.googleapis.co... (continues... it's a json file, contents posted below)
returned "File not found: fileIDhere (continues.. some sort of file id?)
Lastly, here is the json output from the link in the error:
{
"error": {
"errors": [
{
"domain": "global",
"reason": "required",
"message": "Login Required",
"locationType": "header",
"location": "Authorization"
}
],
"code": 401,
"message": "Login Required"
}
}