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 credentials #1184

Merged
merged 1 commit into from
Nov 11, 2022
Merged

feat: add api_key credentials #1184

merged 1 commit into from
Nov 11, 2022

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants