V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
cherbim
V2EX  ›  Python

求助,关于 pydrive

  •  
  •   cherbim · 2020-05-25 20:33:52 +08:00 · 1022 次点击
    这是一个创建于 1403 天前的主题,其中的信息可能已经有所发展或是发生改变。

    使用 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("上传成功")
    
    目前尚无回复
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   943 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 28ms · UTC 21:00 · PVG 05:00 · LAX 14:00 · JFK 17:00
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.