Forums

wich credential to use for Google Drive, for a Flask app on Pythonanywhere

Hello to all, I am going from tutorial to tutorial, but it's so unclear. This one was nice, but I have seen a good number of similar ones. I would like you to help me to tell me what Type of Credential I need.

I want to make some kind of Simple App, to download files from Google Drive, to a local computer using an app created here. May be in the future I will need this for clients but for now I have all passwords, it's our drive. Thanks you in advance.

That tutorial you linked to seems to suggest that you should be using an "OAuth client ID" and I think that that would also be appropriate for the app that you're trying to create.

Thank you Glenn, ok, I will not link to all the different tutorial that I tried, My situation is quite particular. I will make the really long, and painful story hyper short. I will link to Just on site, the one that made a Non error response. Here Just look at the pictures,

I finally had a response like:

Go to the following link in your browser:
https://accounts.google.com/o/oauth2/auth?client_id=206193508616-v0sflvdquf7golk7hort8tqcbb00frjc.apps.googleuserconte
nt.com&redirect_uri=urn%3Aietf%3Awg%3Aoauth%3A2.0%3Aoob&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fdrive&access_type=offline&response_type=code
Enter verification code:

It was the first time I had a no error message.

Then I tried, the Google Account code, The code inside the Json file,

nothing worked.

Which code they need?

EDIT: Yes...I know...I do that a lot...I answer my own questions...But I am sure it will serve someone! You know some other lost in the code middle man... The problem was formulation....And when I reread it it was obvious... You just had to do what the lines said. Copy past in the browser. My mind was just not accepting the necessity to go out of the code.

This also helped me to see the obvious. Please have mercy!

I think you misunderstood what's you need to do. You need to go to that URL in a browser, log in to your google account and enter the verification code that is shown below that output.

Glenn San, It is working good!! Thanks again for the support. Took 2 days to figure out all that.

The down side, is I have to register the app each time.

But the code give result.

I have to select information given in the csv. and automate the download. This will be the next tasks.

from pydrive.auth import GoogleAuth
from pydrive.drive import GoogleDrive
import pandas as pd

gauth = GoogleAuth()
gauth.CommandLineAuth()
drive = GoogleDrive(gauth)


filelist=[]
file_list = drive.ListFile({'q': "'xxxxxxxxxxxxxxxxxx' in parents and trashed=false"}).GetList()

df = pd.DataFrame(file_list)
df.to_csv("test.csv", index=False, encoding="utf-8")

Great! Glad we got there.