grpc/examples/python/data_transmission
Sergii Tkachenko de6ed9ba9f
[Python] Migrate from yapf to black (#33138)
- Switched  from yapf to black
- Reconfigure isort for black
- Resolve black/pylint idiosyncrasies 

Note: I used `--experimental-string-processing` because black was
producing "implicit string concatenation", similar to what described
here: https://github.com/psf/black/issues/1837. While currently this
feature is experimental, it will be enabled by default:
https://github.com/psf/black/issues/2188. After running black with the
new string processing so that the generated code merges these `"hello" "
world"` strings concatenations, then I removed
`--experimental-string-processing` for stability, and regenerated the
code again.

To the reviewer: don't even try to open "Files Changed" tab 😄 It's
better to review commit-by-commit, and ignore `run black and isort`.
2023-06-09 15:08:55 -07:00
..
BUILD Make Buildifier Sanity Test Strict (#27807) 2021-11-03 14:57:04 -07:00
README.cn.md Fix: remove the space on the left of colons 2019-09-17 09:37:56 +08:00
README.en.md fix the wrong word 2019-10-01 05:13:33 +08:00
alts_client.py [Python] Migrate from yapf to black (#33138) 2023-06-09 15:08:55 -07:00
alts_server.py [Python] Migrate from yapf to black (#33138) 2023-06-09 15:08:55 -07:00
client.py [Python] Migrate from yapf to black (#33138) 2023-06-09 15:08:55 -07:00
demo.proto Fix: add copyright headers in `demo.proto` 2019-09-11 10:23:31 +08:00
demo_pb2.py Update third_party/protobuf to 3.21.4 (#30377) 2022-08-04 09:39:49 -07:00
demo_pb2.pyi Update third_party/protobuf to 3.21.4 (#30377) 2022-08-04 09:39:49 -07:00
demo_pb2_grpc.py Update third_party/protobuf to 3.21.4 (#30377) 2022-08-04 09:39:49 -07:00
server.py [Python] Migrate from yapf to black (#33138) 2023-06-09 15:08:55 -07:00

README.en.md

Data transmission demo for using gRPC in Python

Four ways of data transmission when gRPC is used in Python. Official Guide

  • unary-unary

    In a single call, the client can only send request once, and the server can only respond once.

    client.py: simple_method

    server.py: SimpleMethod

  • stream-unary

    In a single call, the client can transfer data to the server an arbitrary number of times, but the server can only return a response once.

    client.py: client_streaming_method

    server.py: ClientStreamingMethod

  • unary-stream

    In a single call, the client can only transmit data to the server at one time, but the server can return the response many times.

    client.py: server_streaming_method

    server.py: ServerStreamingMethod

  • stream-stream

    In a single call, both client and server can send and receive data to each other multiple times.

    client.py: bidirectional_streaming_method

    server.py: BidirectionalStreamingMethod