Hi
I am fairly new to GRPC with Python
I wanted to explore reflection and followed the links provided above.
For testing purposes I create a simple test receiving an Id and returning an associated result.
It works perfectly if I use generated code. Now trying to inspect the server and get the services and instantiate dynamically the logic, I struggle a bit more.
Using snippet like:
reflection_db = ProtoReflectionDescriptorDatabase(channel)
desc_pool = DescriptorPool(reflection_db)
services = reflection_db.get_services()
service = desc_pool.FindServiceByName(xxx)
for m in service.methods:
input_type = m.input_type
and with
request = MessageFactory(desc_pool).GetPrototype(input_type)()
I can build a request
I struggle to instantiate the service and call it with request:
I tried things like:
stub = GeneratedServiceStubType(service.name, (), {GeneratedServiceStubType._DESCRIPTOR_KEY:service }) and then stub.<<myMethod>>(request) but it fails. I need to pass other params but no real clue
The final purpose is to a kind of getAttr(stub,
methode.name, parms)
I looked at code/googled but failed to find any helpful content
Thanks for any help
Cheers
Pascal