MCPcopy Create free account
hub / github.com/NVIDIA/OpenShell / _attach

Method _attach

python/openshell/sandbox.py:86–97  ·  view source on GitHub ↗
(self, details: grpc.ClientCallDetails)

Source from the content-addressed store, hash-verified

84 self._token_provider = token_provider
85
86 def _attach(self, details: grpc.ClientCallDetails) -> grpc.ClientCallDetails:
87 original_metadata = getattr(details, "metadata", None)
88 metadata = list(original_metadata) if original_metadata else []
89 metadata.append(("authorization", f"Bearer {self._token_provider()}"))
90 return _ClientCallDetails(
91 getattr(details, "method", None),
92 getattr(details, "timeout", None),
93 metadata,
94 getattr(details, "credentials", None),
95 getattr(details, "wait_for_ready", None),
96 getattr(details, "compression", None),
97 )
98
99 def intercept_unary_unary(self, continuation, client_call_details, request):
100 return continuation(self._attach(client_call_details), request)

Callers 4

intercept_unary_unaryMethod · 0.95

Calls 1

_ClientCallDetailsClass · 0.85

Tested by

no test coverage detected