Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for google-auth #319

Merged
merged 5 commits into from
Jan 5, 2017
Merged

Conversation

theacodes
Copy link
Contributor

@theacodes theacodes commented Dec 20, 2016

This also obviates the need to pass credentials into discovery.build or discovery.build_from_document if you're using ADC. This library can now automatically acquire those.

@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Dec 20, 2016
@theacodes
Copy link
Contributor Author

FYI @dhermes - I don't know if you care to look at this.

else:
raise EnvironmentError(
'No authentication library is available. Please install either '
'oauth2client or google-auth.')

This comment was marked as spam.

This comment was marked as spam.

@bjwatson
Copy link

@jonparrott I would like @landrito and @lukesneeringer (long-time Pythonista, first-time member of our team) to review this PR. I just gave the latter write access to this repo, and am waiting for him to accept.

@bjwatson bjwatson requested review from landrito and removed request for bjwatson December 21, 2016 13:58
@theacodes
Copy link
Contributor Author

@bjwatson sounds good. No rush.

@lukesneeringer @landrito - this is a very old codebase with a lot of problems. Keep in mind that I tried to be "minimally invasive" here. Feel free to set up some time if you want to talk about context/purpose.

@landrito
Copy link

Gotcha! I'll take a stab at the review and get back to you if I need some clarification.

@theacodes
Copy link
Contributor Author

Travis should now be passing.

Note that this is the change the finally forced us to stop supporting Python 2.6 in this library.

@theacodes
Copy link
Contributor Author

We'd already agreed to drop 2.6 in #203.

@theacodes
Copy link
Contributor Author

@landrito @lukesneeringer friendly ping

@lukesneeringer
Copy link
Contributor

@jonparrott Sorry, getting used to actually watching GitHub notifications. Reviewing now.

@theacodes
Copy link
Contributor Author

theacodes commented Jan 5, 2017 via email

Copy link
Contributor

@lukesneeringer lukesneeringer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The only major feedback I have is that you will probably end up with weird cases/errors in cases where HAS_GOOGLE_AUTH is true but credentials get passed in without being properly instantiated as a google.auth.credentials.Credentials object. A trap I fell into last week was trying to specify credentials as a dictionary (this was with oauth2client), which raised an exception in a confusing way. I found myself wishing that it had just instantiated the appropriate object for me. I still have that thought reading through this.

That said, this looks good, and will not make any existing, working situation worse that I can see. Ship it.

Copy link

@landrito landrito left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add documentation to googleapiclient.discovery.build to show that credentials can be oauth2client.client.Credentials or google.auth.credentials.Credentials.

@theacodes
Copy link
Contributor Author

Add documentation to googleapiclient.discovery.build to show that credentials can be oauth2client.client.Credentials or google.auth.credentials.Credentials.

Good catch. Done.

@theacodes theacodes merged commit 85c2c6d into googleapis:master Jan 5, 2017
@theacodes theacodes deleted the google-auth branch January 5, 2017 20:34
ulzha added a commit to spotify/luigi that referenced this pull request May 23, 2017
Arguments `http` and `credentials` are mutually exclusive as of googleapis/google-api-python-client#319.

This makes the gcloud integration tests pass for me. (They have been disabled on Travis for long because of another reason, still unfixed I guess, #1931.)
akrherz pushed a commit to akrherz/google-api-python-client that referenced this pull request Apr 1, 2019
DictionaryStorage implements an optionally-locked storage over a dictionary-like object.
akrherz pushed a commit to akrherz/google-api-python-client that referenced this pull request Apr 1, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes This human has signed the Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants