File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change 2
2
import urllib .request
3
3
from typing import Any , Dict
4
4
5
+ import grpc
5
6
from clarifai_grpc .channel .clarifai_channel import ClarifaiChannel
6
7
from clarifai_grpc .grpc .api import resources_pb2 , service_pb2_grpc
7
8
@@ -289,7 +290,11 @@ def metadata(self):
289
290
)
290
291
291
292
def get_stub (self ) -> service_pb2_grpc .V2Stub :
292
- """Get the API gRPC stub using the right channel based on the API endpoint base.
293
+ stub , channel = self .get_stub_and_channel ()
294
+ return stub
295
+
296
+ def get_stub_and_channel (self ) -> tuple [service_pb2_grpc .V2Stub , grpc .Channel ]:
297
+ """Get the API gRPC stub and channel based on the API endpoint base.
293
298
294
299
Returns:
295
300
stub: The service_pb2_grpc.V2Stub stub for the API.
@@ -310,7 +315,7 @@ def get_stub(self) -> service_pb2_grpc.V2Stub:
310
315
port = 80
311
316
channel = ClarifaiChannel .get_insecure_grpc_channel (base = host , port = port )
312
317
stub = service_pb2_grpc .V2Stub (channel )
313
- return stub
318
+ return stub , channel
314
319
315
320
def get_async_stub (self ) -> service_pb2_grpc .V2Stub :
316
321
"""Get the API gRPC async stub using the right channel based on the API endpoint base.
You can’t perform that action at this time.
0 commit comments