Skip to content

google-api-python-client 2.6.0, 2.7.0, 2.8.0, 2.9.0 cannot work with google-auth 1.18.0 and earlier #1606

@hehao98

Description

@hehao98

These versions of google-api-python-client requires google-auth>=1.16.0,<2dev. However, some of the code cannot work with google-auth 1.18.0 and earlier becausegoogle.auth.load_credentials_from_file() and google.auth.default() do not accept the quota_project_id parameter. I think it will be better to increase the minimum version of google-auth for these google-api-python-client versions.

Here are the details:

Environment details

  • OS type and version: Ubuntu 20.04
  • Python version: 3.9.7
  • pip version: 21.2.4
  • google-api-python-client version: 2.6.0, 2.7.0, 2.8.0, 2.9.0

Steps to reproduce

Create a clean Python environment and install relevant packages

conda create -n test python=3.9
conda activate test
pip install --no-cache-dir google-auth==1.18.0 google-api-core==1.21.0 google-api-python-client==2.9.0

Code example

(test) heh@ubuntu:~$ python
Python 3.9.7 (default, Sep 16 2021, 13:09:58)
[GCC 7.5.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import googleapiclient._auth as _auth
>>> _auth.credentials_from_file("a")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/heh/anaconda3/envs/test/lib/python3.9/site-packages/googleapiclient/_auth.py", line 44, in credentials_from_file
    credentials, _ = google.auth.load_credentials_from_file(filename, scopes=scopes, quota_project_id=quota_project_id)
TypeError: load_credentials_from_file() got an unexpected keyword argument 'quota_project_id'
>>> _auth.default_credentials("a")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/heh/anaconda3/envs/test/lib/python3.9/site-packages/googleapiclient/_auth.py", line 54, in default_credentials
    credentials, _ = google.auth.default(scopes=scopes, quota_project_id=quota_project_id)
TypeError: default() got an unexpected keyword argument 'quota_project_id'

Metadata

Metadata

Assignees

Labels

🚨This issue needs some love.priority: p2Moderately-important priority. Fix may not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions