I'm now working on a feature that needs server headers in a client 
interceptor. Unfortunately, I see a previous interceptor implemented like 
this:
def wrapper(iterator):
  for entry in iterator:
    yield entry
class MyInterceptor(grpc.StreamStreamClientInterceptor):
  def intercept_stream_stream(self, continuation, client_call_details, 
request_iterator):
    return wrapper(continuation(client_call_details, request_iterator))
The returned object is a bare iterator so that I cannot use 
`response.initial_metadata` to get the headers.

I'm considering three ways to retain the metadata:
1. Delegate last response and do my job in the delegate class.
2. Override `Rendezvous` classes and make new ones to return. (It may lose 
changes made in previous interceptors.)
3. Monkey patch last response. (It cannot patch magic methods)

So the the only clean way is to delegate the response. 
However, the delegation looks ugly, because the class has a dozen of 
methods to delegate.
Is there a clean and beautiful way to do the job?

-- 
You received this message because you are subscribed to the Google Groups 
"grpc.io" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to grpc-io+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/grpc-io/12f15f6e-4546-4214-b004-b0dc94a7da68o%40googlegroups.com.

Reply via email to