Skip to main content

Python gRPC 回调方式实现CS通讯(类flask)

Project description

Documentation

The documentation is hosted at https://github.com/BingerYang/grpc_route

Installation

pip install grpc_route

Usage

server run:

from grpc_route.server import Router

app = Router()


@app.route("index")
def test(n):
    # n / 0
    print("-> to index: ", n)
    return "server back ->"


if __name__ == "__main__":
    app.run_forever("0.0.0.0", port=5656)

client run:

from grpc_route.client import RouteClient
from grpc_route import AddrConf

addr1 = AddrConf("127.0.0.1", 5656)
app = RouteClient(addr1)
app.connect()


@app.register(handler="index", to_addr=addr1)
def run_index(n):
    pass

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

grpc_route-0.1.2.20010521.tar.gz (16.8 kB view details)

Uploaded Source

Built Distribution

grpc_route-0.1.2.20010521-py3-none-any.whl (22.8 kB view details)

Uploaded Python 3

File details

Details for the file grpc_route-0.1.2.20010521.tar.gz.

File metadata

  • Download URL: grpc_route-0.1.2.20010521.tar.gz
  • Upload date:
  • Size: 16.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.41.0 CPython/3.7.4

File hashes

Hashes for grpc_route-0.1.2.20010521.tar.gz
Algorithm Hash digest
SHA256 37611f8f5feb2a25b0f418146c051178478eb78243a22fff63913948efce963f
MD5 80ba2e13eae99ed0ca8315cb278acd4a
BLAKE2b-256 b90edc65775bc67313a60d57b167fbaa637f451c69d2313cc39e48390c601864

See more details on using hashes here.

File details

Details for the file grpc_route-0.1.2.20010521-py3-none-any.whl.

File metadata

  • Download URL: grpc_route-0.1.2.20010521-py3-none-any.whl
  • Upload date:
  • Size: 22.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.41.0 CPython/3.7.4

File hashes

Hashes for grpc_route-0.1.2.20010521-py3-none-any.whl
Algorithm Hash digest
SHA256 417f1023e61db82dcba46ad6f4b7f42a59bbbd78e380d45f35fbf48d0361fcc2
MD5 7bcc2406132439282cfc75de6b965483
BLAKE2b-256 5838d20e4c0cf9d83e27840fd10beb194b3f09a58432a58c2a79efa6d613035e

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 Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page