[英]Fail to authenticate with pydrive to google drive
我正在按照此文檔鏈接上的說明使用 PyDrive 並在運行此部分后
from pydrive.auth import GoogleAuth
gauth = GoogleAuth()
gauth.LocalWebserverAuth() # Creates local webserver and auto handles authentication.
一切似乎都正常,我的瀏覽器打開,我需要使用我的 Gmail 帳戶進行身份驗證。 但是在接受最后一部分后,進程加載並且我在瀏覽器Safari Screenshot 中收到一條錯誤消息,它是德語,它基本上說 safari 無法連接到 localhost:8080。
在終端中,我得到了這個回溯:
Failed to find "code" in the query parameters of the redirect.
Try command-line authentication
Traceback (most recent call last):
File "/Users/gepluse/CodeProjects/ComunioBuster/test2.py", line 4, in <module>
gauth.LocalWebserverAuth() # Creates local webserver and auto handles authentication.
File "/Users/gepluse/CodeProjects/ComunioBuster/venv/lib/python3.8/site-packages/pydrive/auth.py", line 115, in _decorated
code = decoratee(self, *args, **kwargs)
File "/Users/gepluse/CodeProjects/ComunioBuster/venv/lib/python3.8/site-packages/pydrive/auth.py", line 241, in LocalWebserverAuth
raise AuthenticationError('No code found in redirect')
pydrive.auth.AuthenticationError: No code found in redirect
我也跟着這個教程鏈接,我檢查了我做的每一步都沒有成功。
在此處的某些帖子中,防火牆是問題所在,但我的 Mac 上的防火牆未激活。
我正在運行 macOS 10.15.7 / Python 3.8.3 / PyDrive 1.3.1
我根據 Dano 的這個解決方案進行了更改。 mycreds.txt
的保存和加載有助於解決這個問題。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.