使用 pydrive,运行后正常打开授权网址,然后提示授权成功,等一段时间后提示显错误:[WinError 10060] 由于连接方在一段时间后没有正确答复或连接的主机没有反应,连接尝试失败 有没有大佬知道这哪里出问题了,贴上源代码:
from pydrive.auth import GoogleAuth
from pydrive.drive import GoogleDrive
gauth = GoogleAuth()
gauth.LoadCredentialsFile("my_creds.txt")
if gauth.credentials is None:
gauth.LocalWebserverAuth()
elif gauth.access_token_expired:
gauth.Refresh()
else:
gauth.Authorize()
gauth.SaveCredentialsFile("my_creds.txt")
# 上传
drive = GoogleDrive(gauth)
file2 = drive.CreateFile({'title': '{}.txt'.format("2"), 'parents': [{'kind': 'drive#fileLink', 'id': '1Onrny2s0IGdaXBgH9J2DfgK0QqtUY0yb'}]})
print("开始上传")
file2.SetContentFile("my_creds.txt")
file2.Upload()
print("上传成功")