PYTHON-3664 OIDC: Fix GCP headers (#1615)

This commit is contained in:
Steven Silvester 2024-04-24 09:48:29 -05:00 committed by GitHub
parent e8900ad9f4
commit ec5711e4b5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -22,7 +22,7 @@ from urllib.request import Request, urlopen
def _get_gcp_response(resource: str, timeout: float = 5) -> dict[str, Any]:
url = "http://metadata/computeMetadata/v1/instance/service-accounts/default/identity"
url += f"?audience={resource}"
headers = {"Metadata-Flavor": "Google", "Accept": "application/json"}
headers = {"Metadata-Flavor": "Google"}
request = Request(url, headers=headers) # noqa: S310
try:
with urlopen(request, timeout=timeout) as response: # noqa: S310