V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
推荐学习书目
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 · May 25, 2020 · 1501 views
    This topic created in 2170 days ago, the information mentioned may be changed or developed.

    使用 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("上传成功")
    
    No Comments Yet
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   748 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 29ms · UTC 20:36 · PVG 04:36 · LAX 13:36 · JFK 16:36
    ♥ Do have faith in what you're doing.