Hello, I am very new to Python and working with APIs, but I'm trying to build a Twitter bot for a friend that would pull files and such from a shared Google Drive folder, and I'm having difficulties getting PyDrive and/or PyDrive2 set up on a web server. I've been able to get things working when only using my desktop, but for both our sakes we'd like to run it from a web host, right now in our case PythonAnywhere. I've been trying to set up my own OAuth flow with the settings.yaml, but when I attempt to run:
from pydrive2.auth import GoogleAuth
from pydrive2.drive import GoogleDrive
gauth = GoogleAuth()
gauth.LocalWebserverAuth()
drive = GoogleDrive(gauth)
I get an error reading:
Traceback (most recent call last):
File "/home/mortypie/.local/lib/python3.9/site-packages/pydrive2/auth.py", line 516, in LoadClientConfigSettings
self.client_config[config] = self.settings["client_config"][
KeyError: 'client_config'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/mortypie/quickstart.py", line 5, in <module>
gauth.LocalWebserverAuth()
File "/home/mortypie/.local/lib/python3.9/site-packages/pydrive2/auth.py", line 123, in _decorated
self.GetFlow()
File "/home/mortypie/.local/lib/python3.9/site-packages/pydrive2/auth.py", line 532, in GetFlow
self.LoadClientConfig()
File "/home/mortypie/.local/lib/python3.9/site-packages/pydrive2/auth.py", line 423, in LoadClientConfig
self.LoadClientConfigSettings()
File "/home/mortypie/.local/lib/python3.9/site-packages/pydrive2/auth.py", line 520, in LoadClientConfigSettings
raise InvalidConfigError(
pydrive2.settings.InvalidConfigError: Insufficient client config in settings
Does anyone know where the hang up might be? I'm not experienced enough yet to know what adjustments need to be made. The only thing I've changed in the auth.py is in line 151 of auth.py to read "client_config_backend": "settings" rather than "client_config_backend": "file".
@mortypie I don't know how to reproduce this tbh. Could you package and publish files that are needed to reproduce please? (avoid sharing client ID and secret). Feel free to reopen when you add more details.
Hello, I am very new to Python and working with APIs, but I'm trying to build a Twitter bot for a friend that would pull files and such from a shared Google Drive folder, and I'm having difficulties getting PyDrive and/or PyDrive2 set up on a web server. I've been able to get things working when only using my desktop, but for both our sakes we'd like to run it from a web host, right now in our case PythonAnywhere. I've been trying to set up my own OAuth flow with the settings.yaml, but when I attempt to run:
I get an error reading:
Does anyone know where the hang up might be? I'm not experienced enough yet to know what adjustments need to be made. The only thing I've changed in the auth.py is in line 151 of auth.py to read
"client_config_backend": "settings"
rather than"client_config_backend": "file"
.My
settings.yaml
file looks like