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.1.20010315.tar.gz (14.5 kB view details)

Uploaded Source

Built Distribution

grpc_route-0.1.1.20010315-py3-none-any.whl (18.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: grpc_route-0.1.1.20010315.tar.gz
  • Upload date:
  • Size: 14.5 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.1.20010315.tar.gz
Algorithm Hash digest
SHA256 3d8cd6f4b51a4173a8d2e071c1a01bb213b47364133ba789d7dc28f48560cd2f
MD5 178d8c9e1c9ea36db4e51593a8e7b9f5
BLAKE2b-256 100c4aa6cd7ac94e975d79626ce4e814868aacb5338a8d94b169486f271d96ff

See more details on using hashes here.

File details

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

File metadata

  • Download URL: grpc_route-0.1.1.20010315-py3-none-any.whl
  • Upload date:
  • Size: 18.4 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.1.20010315-py3-none-any.whl
Algorithm Hash digest
SHA256 8a70d87c74b3c892828176db35526b8496d182fcd67b595e30b386abc277a134
MD5 d63b7d9551a807191f465305a5388ffa
BLAKE2b-256 fb23ce6266f1cbb7763b20593e30f289135e78e7513a16602b97536810e5cb26

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