python-grpc
python-grpc copied to clipboard
cannot use intercept_channel with `with` statement
grpc channel is usually used with with
statement like here -> https://github.com/grpc/grpc/blob/master/examples/python/helloworld/greeter_client_with_options.py#L31
but...
import opentracing
from grpc_opentracing import open_tracing_client_interceptor
from grpc_opentracing.grpcext import intercept_channel
from grpc import insecure_channel
ic = open_tracing_client_interceptor(opentracing.global_tracer())
with intercept_channel(insecure_channel("localhost:5000"), ic) as ch:
pass # blabla
Traceback (most recent call last):
File "testwith.py", line 7, in <module>
with intercept_channel(insecure_channel("localhost:5000"), ic) as ch:
AttributeError: __enter__