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.

Files for grpc-route, version 0.1.2.20010521
Filename, size File type Python version Upload date Hashes
Filename, size grpc_route-0.1.2.20010521-py3-none-any.whl (22.8 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size grpc_route-0.1.2.20010521.tar.gz (16.8 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page