How can I read grpc proto request in interceptor with Python?
In PHP, I can read the $argument
, it's what I need.
<?php
use Grpc\Interceptor;
class MyInterceptor extends Interceptor
{
public function interceptUnaryUnary($method,
$argument,
$deserialize,
array $metadata = [],
array $options = [],
$continuation)
{
// $argument is what I needto
return parent::interceptUnaryUnary($method, $argument, $deserialize, $metadata, $options, $continuation);
}
}
Unfortunately, gRPC Python doesn't have a complete server interceptor implemenataion that allow you to access request
or servicer_context
, but you may access to method
string and invocation_metadata
, for more detail check the history. If the semantic you want to achieve can be implemented in Python's metaclass or inheritance, please do so. If you would like to request for this feature, please post an issue in the GitHub repo grpc/grpc...
Here are some resources that might help you find the answer: