Skip to content
This repository was archived by the owner on Mar 6, 2026. It is now read-only.

feat: add api_key credentials#1184

Merged
arithmetic1728 merged 1 commit intomainfrom
api_key_option
Nov 11, 2022
Merged

feat: add api_key credentials#1184
arithmetic1728 merged 1 commit intomainfrom
api_key_option

Conversation

@arithmetic1728
Copy link
Contributor

This PR adds a new credential type for API key, and the get_api_key_credentials method needed by GAPIC clients (see here) to enable API key support. Once this PR is released in auth lib, GAPIC clients will be able to use API key with the latest auth lib. This feature has been tested with the following sample.

import google.cloud.language_v1
import google.api_core.client_options

# provide api key value via client options
client = google.cloud.language_v1.LanguageServiceClient(client_options={"api_key":"FILL IN"})

request = {'document': { 'type_': 'PLAIN_TEXT', 'content': "hello" }, 'encoding_type': 'UTF8'}
response = client.analyze_sentiment(request)

print(response)

@arithmetic1728 arithmetic1728 requested a review from a team November 11, 2022 21:54
@arithmetic1728 arithmetic1728 requested a review from a team as a code owner November 11, 2022 21:54
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants