Skip to content

azicen/protoc-gen-pyhttp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

protoc-gen-pyhttp

一个用于快速将.proto构建为Python使用的HTTP Api工具

使用

使用PyPI安装

安装protoc-gen-pyhttp

pip install protoc-gen-pyhttp

安装可能需要使用的其他软件包

pip install protobuf \
            types-protobuf \
            googleapis-common-protos \
            googleapis-common-protos-stubs \
            grpcio-tools

构建HTTP Api需要使用到protoc工具,该工具由grpcio-tools包提供(您也可以使用protobuf的可执行文件替代这个包),同时需要使用到将.proto文件构建为Python类型的功能,protobuftypes-protobufgoogleapis-common-protosgoogleapis-common-protos-stubs这些软件包提供了这个功能。

将proto文件构建为HTTP Api

protoc --proto_path=./proto \
       --python_out=. \
       --pyi_out=. \
       --pyhttp_out=. \
       you_proto_file_list...

使用--proto_path设置proto文件所在的路径,该参数可以有多个;使用--python_out设置构建Python类型的存放路径;使用--pyi_out设置构建用于IDE工具识别Python文件的存放路径;使用--pyhttp_out设置构建HTTP Api的存放路径。

About

Generate server classes that correspond to services defined in http-protobuf.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published