I search for google but get no result, my code is as follow:
import sys
reload(sys)
sys.setdefaultencoding("utf-8")
from pydrive.auth import GoogleAuth
from pydrive.drive import GoogleDrive
# this function used inside function do_the_work(drive)
def upload_gd(media_file, drive):
print 'Try uploading ' + media_file
xfile = drive.CreateFile()
xfile.SetContentFile(media_file)
xfile.Upload()
print('Created file %s with mimeType %s' % (xfile['title'], xfile['mimeType']))
permission = xfile.InsertPermission({
'type': 'anyone',
'value': 'anyone',
'role': 'reader'})
print 'Sharable link (to view) is:' + xfile['alternateLink']
print 'Get direct link'
file_id = xfile['alternateLink'].split('/')[-2]
print 'file ID: ' + file_id
d_link = 'https://drive.google.com/uc?export=download&id=' + file_id
print 'Direct link is: ' + d_link
return d_link
gauth = GoogleAuth()
gauth.LocalWebserverAuth()
drive = GoogleDrive(gauth)
do_the_work(drive)
And, the permissions I get for the file is:
But, I only want anyone can view, but not findable as: