Skip to main content

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

Project description

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的存放路径。

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

protoc-gen-pyhttp-1.0.0rc3.tar.gz (9.7 kB view details)

Uploaded Source

Built Distribution

protoc_gen_pyhttp-1.0.0rc3-py3-none-any.whl (9.4 kB view details)

Uploaded Python 3

File details

Details for the file protoc-gen-pyhttp-1.0.0rc3.tar.gz.

File metadata

  • Download URL: protoc-gen-pyhttp-1.0.0rc3.tar.gz
  • Upload date:
  • Size: 9.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.5

File hashes

Hashes for protoc-gen-pyhttp-1.0.0rc3.tar.gz
Algorithm Hash digest
SHA256 c23268d22e253d5968bf267c1eba3015a846374f6caf731046849597a3bcb3bd
MD5 4b1a7df325776edd3b37ba5c7d23e951
BLAKE2b-256 b2ef1b8659cb0912de9c1f686c88fec1f1689815faa1ac45fcbe6532aebf475a

See more details on using hashes here.

File details

Details for the file protoc_gen_pyhttp-1.0.0rc3-py3-none-any.whl.

File metadata

File hashes

Hashes for protoc_gen_pyhttp-1.0.0rc3-py3-none-any.whl
Algorithm Hash digest
SHA256 dc164fec1c6d4dc499d33e9cab333723af0e60b37142bd863856e16930ea08ad
MD5 ade3be3c3ed54873975ce561d2c3ac44
BLAKE2b-256 5603c186cc4e8ed7cdbc8409da1f05959a50f927a714d436f0b4f957f4d4457a

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page