MCPcopy Create free account
hub / github.com/google/adk-python / _get_identity_token

Function _get_identity_token

tests/remote/triggers/conftest.py:59–75  ·  view source on GitHub ↗

Fetch an identity token for the given audience via gcloud.

(audience: str)

Source from the content-addressed store, hash-verified

57
58
59def _get_identity_token(audience: str) -> str | None:
60 """Fetch an identity token for the given audience via gcloud."""
61 try:
62 result = subprocess.run(
63 [
64 "gcloud",
65 "auth",
66 "print-identity-token",
67 f"--audiences={audience}",
68 ],
69 capture_output=True,
70 text=True,
71 check=True,
72 )
73 return result.stdout.strip()
74 except (FileNotFoundError, subprocess.CalledProcessError):
75 return None
76
77
78# ---------------------------------------------------------------------------

Callers 1

auth_headersFunction · 0.85

Calls 2

stripMethod · 0.80
runMethod · 0.45

Tested by

no test coverage detected