grpc-interceptor:简化的 Python gRPC 拦截器

时间:2021-05-31 05:36:14
【文件属性】:
文件名称:grpc-interceptor:简化的 Python gRPC 拦截器
文件大小:55KB
文件格式:ZIP
更新时间:2021-05-31 05:36:14
Python 概括 简化的 Python gRPC 拦截器。 Python grpc包提供了服务拦截器,但由于它们的灵活性,它们有点grpc 。 grpc拦截器无法直接访问请求和响应对象或服务上下文。 通常需要访问这些,以便能够在请求或响应中记录数据,或者在上下文中设置状态代码。 安装 要获取拦截器(可能不编写自己的拦截器),请执行以下操作: $ pip install grpc-interceptor 还要获得测试框架,如果您正在编写自己的拦截器,这很好: $ pip install grpc-interceptor[testing] 用法 服务器拦截器 定义您自己的拦截器(我们可以使用ExceptionToStatusInterceptor作为示例): from grpc_interceptor import ServerInterceptor from grpc_interceptor
【文件预览】:
grpc-interceptor-master
----mypy.ini(63B)
----.flake8(300B)
----.github()
--------release-drafter.yml(755B)
--------workflows()
----poetry.lock(63KB)
----noxfile.py(3KB)
----src()
--------grpc_interceptor()
----LICENSE(1KB)
----README.md(6KB)
----Makefile(526B)
----docs()
--------reference.rst(397B)
--------conf.py(627B)
--------requirements.txt(14B)
--------index.rst(9KB)
--------license.rst(41B)
----tests()
--------test_client.py(8KB)
--------test_exception_to_status.py(5KB)
--------__init__.py(39B)
--------test_streaming.py(2KB)
--------test_server.py(5KB)
----.readthedocs.yml(194B)
----.gitignore(121B)
----pyproject.toml(1KB)
----CHANGELOG.md(2KB)

网友评论