nithinmurali / pygsheets

Google Sheets Python API v4

Home Page:https://pygsheets.readthedocs.io/en/latest

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Use google.auth.Credential for authorization

steveoh opened this issue · comments

Is your feature request related to a problem? Please describe.

I can't seem to find a way to use pygsheets in a GCP cloud function that can use the default application credentials of the function. pygsheets gives me a lot of options to use service account keys but I do not want to have to manage a service account key, rotate it, etc.

Describe the solution you'd like

When running in GCP I'd like to either be able to use the google.auth.Credential object to authorize pygsheets or have a parameterless constructor that delegates to google.auth.default().

Any other info

Is there currently a way to use the results of credentials, project = google.auth.default()

Ok tried it and saw this works great

        credentials, project = google.auth.default()
        gc = pygsheets.authorize(custom_credentials = credentials)