-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Description
When googleapiclient._auth.with_scopes(...) gets called (e.g., as a consequence of calling googleapiclient.discovery.build(...)) in an environment with google-auth and google-auth-httplib2 installed, the following crash occurs:
Traceback (most recent call last):
File "", line 1, in
File "/usr/local/lib/python2.7/dist-packages/oauth2client/_helpers.py", line 133, in positional_wrapper
return wrapped(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/googleapiclient/discovery.py", line 226, in build
credentials=credentials)
File "/usr/local/lib/python2.7/dist-packages/oauth2client/_helpers.py", line 133, in positional_wrapper
return wrapped(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/googleapiclient/discovery.py", line 361, in build_from_document
credentials = _auth.with_scopes(credentials, scopes)
File "/usr/local/lib/python2.7/dist-packages/googleapiclient/_auth.py", line 61, in with_scopes
credentials, google.auth.credentials.Credentials):
AttributeError: 'module' object has no attribute 'credentials'
This appears to be because googleapiclient._auth.with_scopes(...) attempts to test if the credentials object is an instance of google.auth.credentials.Credentials, but google.auth.credentials is never imported. Testing most likely missed this bug because the module containing the test for _auth.with_scopes(...) imports google.auth.credentials.