https://github.com/liut/grpc-retry-py
Retry call of gRPC stub
https://github.com/liut/grpc-retry-py
golang grpc python
Last synced: 8 months ago
JSON representation
Retry call of gRPC stub
- Host: GitHub
- URL: https://github.com/liut/grpc-retry-py
- Owner: liut
- License: mit
- Created: 2017-05-10T10:48:26.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2017-05-10T10:49:02.000Z (about 9 years ago)
- Last Synced: 2025-04-04T15:50:53.594Z (about 1 year ago)
- Topics: golang, grpc, python
- Language: Python
- Size: 3.91 KB
- Stars: 14
- Watchers: 1
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Retry call of gRPC stub
The implement of code inspiration from [google-cloud-python#2583](https://github.com/GoogleCloudPlatform/google-cloud-python/issues/2583)
Tested OK with `grpcio==1.3.0`
```py
from grpc_retry import retrying_stub_methods
channel = grpc.insecure_channel('localhost:50051')
stub = helloworld_pb2_grpc.GreeterStub(channel)
# os.setenv('GRPC_RETRY_UNAVAILABLE', 5)
# os.setenv('GRPC_RETRY_DEADLINE_EXCEEDED', 4)
retrying_stub_methods(stub)
response = stub.SayHello(helloworld_pb2.HelloRequest(name='you'))
print("Greeter client received: " + response.message)
```