Google cloud platform 如何导入gRPC empty和Google api注释原型

Google cloud platform 如何导入gRPC empty和Google api注释原型,google-cloud-platform,protocol-buffers,google-cloud-endpoints,grpc,protoc,Google Cloud Platform,Protocol Buffers,Google Cloud Endpoints,Grpc,Protoc,我正在尝试使用谷歌云端点来制作一个基于gRPC的api,它可以。我正在关注,但我无法找到任何关于如何正确导入和编译annotation.proto或empty.proto的文档 谢谢大家! 我不明白这是grpc网关的一部分。由我跑 并成功编译。默认情况下不包括empty.proto和annotation.proto,因此您需要带一份副本。具体来说,您可以在项目的目录中复制它们,或者在现有项目中引用它们(例如Protobuf git repo) 不引用grpc生态系统/grpc网关使用的副本可能是

我正在尝试使用谷歌云端点来制作一个基于gRPC的api,它可以。我正在关注,但我无法找到任何关于如何正确导入和编译annotation.proto或empty.proto的文档


谢谢大家!

我不明白这是grpc网关的一部分。由我跑


并成功编译。

默认情况下不包括empty.proto和annotation.proto,因此您需要带一份副本。具体来说,您可以在项目的目录中复制它们,或者在现有项目中引用它们(例如Protobuf git repo)

不引用grpc生态系统/grpc网关使用的副本可能是一个好主意,因为他们可能希望在将来移动它。

这可能不是一个好主意。 您可以将
google/api/annotations.proto
google/api/http.proto
复制到本地项目中,并在运行
python-m

mkdir -p google/api    
curl https://raw.githubusercontent.com/googleapis/googleapis/master/google/api/annotations.proto > google/api/annotations.proto     
curl https://raw.githubusercontent.com/googleapis/googleapis/master/google/api/http.proto > google/api/http.proto

python -m grpc_tools.protoc google/api/http.proto google/api/annotations.proto -I. --python_out=. --grpc_python_out=. your_proto.proto

加油:

谢谢,这很简单,而且效果很好!这对我不起作用。我有grpcio和grpcio工具。添加这两个文件时,我发现错误“google.protobuf.MethodOptions”没有定义(在annotations.proto中)。如何度过这一关?
mkdir -p google/api    
curl https://raw.githubusercontent.com/googleapis/googleapis/master/google/api/annotations.proto > google/api/annotations.proto     
curl https://raw.githubusercontent.com/googleapis/googleapis/master/google/api/http.proto > google/api/http.proto

python -m grpc_tools.protoc google/api/http.proto google/api/annotations.proto -I. --python_out=. --grpc_python_out=. your_proto.proto