求助,关于 pydrive

2020-05-25 20:33:52 +08:00
 cherbim

使用 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("上传成功")
1049 次点击
所在节点    Python
0 条回复

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/675388

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX