GRPC is a modern open source high performance Remote Procedure Call (RPC) framework that can run in any environment. It can efficiently connect services in and across data centers with pluggable support for load balancing, tracing, health checking and authentication. It is also applicable in last mile of. Sep 13, 2016 In the linked Python example, you define a protolibrary, then create a pyprotolibrary, then create a pygrpclibrary. Furthermore, the pygrpclibrary requires a 'srcs' attribute of which it is taking the name of the protolibrary and in deps it takes the pyprotolibrary. What is going on here?
Simplifies gRPC interceptors
Simplified Python gRPC interceptors.
grpc package provides service interceptors, but they're a bit hard touse because of their flexibility. The
grpc interceptors don't have direct accessto the request and response objects, or the service context. Access to these are oftendesired, to be able to log data in the request or response, or set status codes on thecontext.
To just get the interceptors (and probably not write your own):
To also get the testing framework, which is good if you're writing your own interceptors:
To define your own interceptor (we can use
ExceptionToStatusInterceptor as an example):
Then inject your interceptor when you create the
This results in the gRPC status status code being set to
NOT_FOUND,and the details
'Sorry, your thing is missing'. This saves you the hassle ofcatching exceptions in your service handler, or passing the context down intohelper functions so they can call
context.set_code. It allowsthe more Pythonic approach of just raising an exception from anywhere in the code,and having it be handled automatically.
We will use an invocation metadata injecting interceptor as an example of defininga client interceptor:
Now inject your interceptor when you create the
Client interceptors can also be used to retry RPCs that fail due to specific errors, ora host of other use cases. There are some basic approaches in the tests to get youstarted.
Read the complete documentation here.
Release historyRelease notifications RSS feed
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Python Grpc Dns
|Filename, size||File type||Python version||Upload date||Hashes|
|Filename, size grpc_interceptor-0.13.0-py3-none-any.whl (17.5 kB)||File type Wheel||Python version py3||Upload date||Hashes|
|Filename, size grpc-interceptor-0.13.0.tar.gz (15.7 kB)||File type Source||Python version None||Upload date||Hashes|
Hashes for grpc_interceptor-0.13.0-py3-none-any.whl
Hashes for grpc-interceptor-0.13.0.tar.gz