我正在尝试使用 GOOGLE Drive Api 从电脑上传多个文件到云端硬盘
from pydrive.auth import GoogleAuth
from pydrive.drive import GoogleDrive
import os
gauth = GoogleAuth()
gauth.LocalWebserverAuth()
drive = GoogleDrive(gauth)
entries = os.scandir('../media/series-00000/')
f=[]
a='../media/series-00000/'
for entry in entries:
print(entry.name)
k=str(entry.name)
f.append(os.path.join(a, k))
folder_name = 'testupload'
folder = drive.CreateFile({'title' : folder_name, 'mimeType' : 'application/vnd.google-
apps.folder'})
folder.Upload()
print ('File ID: %s' % folder.get('id'))
a=str(folder.get('id'))
for upload_file in f:
gfile = drive.CreateFile({'parents': [{'id': a}]})
gfile.SetContentFile(upload_file)
gfile.Upload() # Upload the file.
print('success')
但是当我运行代码时,它只上传文件夹中一半或 1/3 的文件。
这是错误
ssl.SSLEOFError: EOF occurred in violation of protocol (_ssl.c:1129)
None
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)