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

Feat: Add api_key argument to Client constructor #1441

Merged
merged 3 commits into from
Feb 27, 2025
Merged

Conversation

andrewsg
Copy link
Contributor

No description provided.

Verified

This commit was signed with the committer’s verified signature.
Okeanos Nikolas Grottendieck
@andrewsg andrewsg requested review from a team as code owners February 21, 2025 23:58
@product-auto-label product-auto-label bot added size: m Pull request size is medium. api: storage Issues related to the googleapis/python-storage API. labels Feb 21, 2025
:param api_key:
(Optional) An API key. Mutually exclusive with any other credentials.
This parameter is an alias for setting `client_options.api_key` and
will supercede any api key set in the `client_options` parameter.
Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for working on this. While I understand that allowing api key-based access is the main goal, is there a specific reason why we need to add a parameter as an alias?

client_options is an existing parameter, and both a dictionary or ClientOption instance is supported, making it quite easy for users to pass it in.

client_options = {"api_key": api_key}
client = Client(client_options=client_options)

Could you share more context on the user journey and requirements for this, thanks!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was the result of a discussion with the PM. Basically, the overarching design philosophy was to make it as easy to use as possible, and this alias is inexpensive for us to maintain and improves usability and legibility.

@andrewsg andrewsg requested a review from a team as a code owner February 27, 2025 18:35
@andrewsg andrewsg added the automerge Merge the pull request once unit tests and other checks pass. label Feb 27, 2025
@gcf-merge-on-green gcf-merge-on-green bot merged commit c869e15 into main Feb 27, 2025
13 checks passed
@gcf-merge-on-green gcf-merge-on-green bot removed the automerge Merge the pull request once unit tests and other checks pass. label Feb 27, 2025
@gcf-merge-on-green gcf-merge-on-green bot deleted the api-key branch February 27, 2025 23:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: storage Issues related to the googleapis/python-storage API. size: m Pull request size is medium.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants