iterative / PyDrive2

Google Drive API Python wrapper library. Maintained fork of PyDrive.

Home Page:https://docs.iterative.ai/PyDrive2

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Fail to authenticate with pydrive2 to google drive

andrei-volkau opened this issue · comments

I am using the following standard code.

from pydrive2.drive import GoogleDrive
from pydrive2.auth import GoogleAuth

# Authenticate and create the PyDrive client.
gauth = GoogleAuth()
gauth.LocalWebserverAuth()
drive = GoogleDrive(gauth)

I am getting the following error.
Screenshot 2023-08-30 at 23 20 38

I am using MacOS (intel).

I was able to find such issue in stackoverflow also

https://stackoverflow.com/questions/64995468/fail-to-authenticate-with-pydrive-to-google-drive

The solution from stackoverflow is not working for me.

I am using PyDrive2 1.17.0

How can I sole the issue? I am using port 8080. Should I try another port?

What do you see in the command line when you run it and try to connect?

What do you in the command line when you run it and try to connect?

I simply execute my script via python

For example, python main.py

@andrei-volkau sorry, do you see any output there?

Are you running the code natively or in a docker image (like a colab runtime)?

Try seeing if the webserver is listening on port 8080 using lsof -i
Also try doing a tcpdump to see if the packets come through tcpdump -i lo -vvv port 8080

if in docker you'll have to pass port 8080 through to the main OS -p 127.0.0.1:8080:8080