3

I'm trying upload multiple files from pc on Drive using GG 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')

But when i run code, it only uploads half or 1/3 of the files in the folder. And here is the error

ssl.SSLEOFError: EOF occurred in violation of protocol (_ssl.c:1129)
anh1301
  • 33
  • 3

0 Answers0