共计 1519 个字符,预计需要花费 4 分钟才能阅读完成。
安装正常流程操作,然后获取到 Google Drive 的授权码,使用命令填入授权码
gdfstool auth -a /var/cache/gdfs.creds "你的授权码"
出现如下错误
Traceback (most recent call last):
File "/usr/bin/gdfstool", line 125, in <module>
main()
File "/usr/bin/gdfstool", line 118, in main
_handle_auth(args)
File "/usr/bin/gdfstool", line 56, in _handle_auth
_handle_auth_store(*args.auth)
File "/usr/bin/gdfstool", line 50, in _handle_auth_store
authorize.step2_doexchange(authcode)
File "/usr/lib/python2.7/site-packages/gdrivefs/gdtool/oauth_authorize.py", line 143, in step2_doexchange
raise AuthorizationFailureError(message)
gdrivefs.errors.AuthorizationFailureError: Could not do auth-exchange (this was either a legitimate error, or the auth-exchange was attempted when not necessary): [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:579)
使用命令查询 pip 列表各版本
pip list
查询可知 httplib2 版本为 0.8,使用命令升级 httplib2
pip install --upgrade httplib2

再次填入授权码命令即可,成功输出如下
Authorization code recorded.
授权码好像有一定时效,过期将输出如下错误
Traceback (most recent call last):
File "/usr/bin/gdfstool", line 125, in <module>
main()
File "/usr/bin/gdfstool", line 118, in main
_handle_auth(args)
File "/usr/bin/gdfstool", line 56, in _handle_auth
_handle_auth_store(*args.auth)
File "/usr/bin/gdfstool", line 50, in _handle_auth_store
authorize.step2_doexchange(authcode)
File "/usr/lib/python2.7/site-packages/gdrivefs/gdtool/oauth_authorize.py", line 143, in step2_doexchange
raise AuthorizationFailureError(message)
gdrivefs.errors.AuthorizationFailureError: Could not do auth-exchange (this was either a legitimate error, or the auth-exchange was attempted when not necessary): invalid_grant
遇到如上情况,重新输入如下命令认真 Google Drive 接口授权认证即可
gdfstool auth -u
正文完
发表至: 系统运维
2018-07-29