Код: Выделить всё
from pydrive.auth import GoogleAuth
gauth = GoogleAuth()
gauth.LoadClientConfigFile("client_secrets.json")
print(f'==== called LoadClientConfigFile', flush=True)
gauth.LocalWebserverAuth() # Prompt for authentication via web browser
Код: Выделить всё
==== called LoadClientConfigFile
Traceback (most recent call last):
File "C:\Users\r\.virtualenvs\pygmu-oJfXpe_C\Lib\site-packages\pydrive\auth.py", line 475, in Refresh
self.credentials.refresh(self.http)
File "C:\Users\r\.virtualenvs\pygmu-oJfXpe_C\Lib\site-packages\oauth2client\client.py", line 545, in refresh
self._refresh(http)
File "C:\Users\r\.virtualenvs\pygmu-oJfXpe_C\Lib\site-packages\oauth2client\client.py", line 761, in _refresh
self._do_refresh_request(http)
File "C:\Users\r\.virtualenvs\pygmu-oJfXpe_C\Lib\site-packages\oauth2client\client.py", line 819, in _do_refresh_request
raise HttpAccessTokenRefreshError(error_msg, status=resp.status)
oauth2client.client.HttpAccessTokenRefreshError: invalid_grant: Bad Request
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\r\Projects\pygmu\t1.py", line 6, in
gauth.LocalWebserverAuth() # Prompt for authentication via web browser
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\r\.virtualenvs\pygmu-oJfXpe_C\Lib\site-packages\pydrive\auth.py", line 120, in _decorated
self.Refresh()
File "C:\Users\r\.virtualenvs\pygmu-oJfXpe_C\Lib\site-packages\pydrive\auth.py", line 477, in Refresh
raise RefreshError('Access token refresh failed: %s' % error)
pydrive.auth.RefreshError: Access token refresh failed: invalid_grant: Bad Request
Есть идеи, как диагностировать и/или исправить это?
Обновить
Обратите внимание, что окно веб-сервера не появляется, поэтому я не уверен, в чем проблема.
Окружающая среда
- Python 3.12
- Windows 11 Pro, версия 23H2
- Доступные браузеры: Firefox, Chrome, Edge
Подробнее здесь: https://stackoverflow.com/questions/790 ... serverauth