无法通过pydrive到google drive的身份验证

2024-05-29 07:01:21 发布

您现在位置:Python中文网/ 问答频道 /正文

我按照说明在本文档中使用PyDrive link 在运行这个部分之后

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

我也遵循了这个教程link,我检查了我做的每一步,几次都没有成功

在这里的一些帖子中,防火墙是问题所在,但我的Mac电脑上的防火墙没有激活

我正在运行macOS 10.15.7/Python 3.8.3/PyDrive 1.3.1


Tags: inauthauthenticationlinecodeplususersredirect

热门问题