gRPC如何节省您的开发时间( 四 )

 
生成代码后 , 希望将代码用于服务器或客户端的存根以调用服务的用户(开发人员)可以使用pip命令下载

pip install -e git+https://github.com/redcranetech/grpcspec-example.git#egg=pygrpcspec
 
然后用
from pygrpcspec.proto import todo_pb2_grpcfrom pygrpcspec.proto import todo_pb2 
综上所述 , 由于protobuf的语法严格性可以将gRPC编译成多种不同语言的客户端代码 , 因此gRPC是在微服务之间进行通信的一种绝佳方式 。
All codes in this article:
- https://github.com/redcranetech/grpcspec-example
- https://github.com/redcranetech/grpc-go-example
- https://github.com/redcranetech/grpc-python-example
 
(本文翻译自Napon Mekavuthikul的文章《gRPC and why it can save you development time》 , 参考:https://medium.com/red-crane/grpc-and-why-it-can-save-you-development-time-436168fd0cbc)




推荐阅读