-
Notifications
You must be signed in to change notification settings - Fork 1.7k
fix: deduplicate x-goog-api-client headers #17616
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
Changes from all commits
7658d02
7d266a3
852c5b1
0d8865a
76274ca
e42f0a3
fc05e08
e6957fb
50283ba
9a1ce95
978b267
19a0099
358d71c
840843a
b2dde95
049f10b
cc47ba6
0bff55c
c90d469
94c1203
a38f0f9
c4d6539
e19d420
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -254,11 +254,20 @@ def _create_composite_credentials( | |
| request = google.auth.transport.requests.Request() | ||
|
|
||
| # Create the metadata plugin for inserting the authorization header. | ||
| metadata_plugin = google.auth.transport.grpc.AuthMetadataPlugin( | ||
| credentials, | ||
| request, | ||
| default_host=default_host, | ||
| ) | ||
| try: | ||
| metadata_plugin = google.auth.transport.grpc.AuthMetadataPlugin( | ||
| credentials, | ||
| request, | ||
| default_host=default_host, | ||
| suppress_metrics_header=True, | ||
| ) | ||
| except TypeError: | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just double checking it is intended/desirable to catch/handle ALL TypeErrors that could be raised?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. TypeError is what Python raises when an invalid kwarg argument is passed, so this is as specific as we can be here. If something else is causing the error, we would expect to see it on the next line |
||
| # Support older versions of google-auth that do not accept suppress_metrics_header | ||
| metadata_plugin = google.auth.transport.grpc.AuthMetadataPlugin( | ||
| credentials, | ||
| request, | ||
| default_host=default_host, | ||
| ) | ||
|
|
||
| # Create a set of grpc.CallCredentials using the metadata plugin. | ||
| google_auth_credentials = grpc.metadata_call_credentials(metadata_plugin) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This return type tuple doc string seems to be reversed from the actual return tuple which is the string first and then the metadata
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch, fixed