Feat: Add api_key argument to Client constructor#1441
Merged
gcf-merge-on-green[bot] merged 3 commits intomainfrom Feb 27, 2025
Merged
Feat: Add api_key argument to Client constructor#1441gcf-merge-on-green[bot] merged 3 commits intomainfrom
gcf-merge-on-green[bot] merged 3 commits intomainfrom
Conversation
cojenco
reviewed
Feb 25, 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. |
Contributor
There was a problem hiding this comment.
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!
Contributor
Author
There was a problem hiding this comment.
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.
cojenco
approved these changes
Feb 27, 2025
gcf-merge-on-green bot
pushed a commit
that referenced
this pull request
Feb 28, 2025
🤖 I have created a release *beep* *boop* --- ## [3.1.0](https://togithub.com/googleapis/python-storage/compare/v3.0.0...v3.1.0) (2025-02-27) ### Features * Add api_key argument to Client constructor ([#1441](https://togithub.com/googleapis/python-storage/issues/1441)) ([c869e15](https://togithub.com/googleapis/python-storage/commit/c869e15ec535a0aa50029d30b6a3ce64ff119b5f)) * Add Bucket.move_blob() for HNS-enabled buckets ([#1431](https://togithub.com/googleapis/python-storage/issues/1431)) ([24c000f](https://togithub.com/googleapis/python-storage/commit/24c000fb7b9f576e6d6c6ec5733f3971fe133655)) --- This PR was generated with [Release Please](https://togithub.com/googleapis/release-please). See [documentation](https://togithub.com/googleapis/release-please#release-please).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.