1# Retry Example in gRPC Python 2 3## Prerequisite 4 5* grpcio >= 1.39.0 6* grpcio-tools >= 1.39.0 7 8## Running the example 9 10In terminal 1, start the flaky server: 11 12```sh 13python3 flaky_server.py 14``` 15 16In terminal 2, start the retry clients: 17 18```sh 19python3 retry_client.py 20# Or 21python3 async_retry_client.py 22``` 23 24## Expect results 25 26The client RPC will succeed, even with server injecting multiple errors. Here is an example server log: 27 28```sh 29$ python3 flaky_server.py 30INFO:root:Starting flaky server on [::]:50051 31INFO:root:Injecting error to RPC from ipv6:[::1]:54471 32INFO:root:Successfully responding to RPC from ipv6:[::1]:54473 33INFO:root:Injecting error to RPC from ipv6:[::1]:54491 34INFO:root:Injecting error to RPC from ipv6:[::1]:54581 35INFO:root:Injecting error to RPC from ipv6:[::1]:54581 36INFO:root:Injecting error to RPC from ipv6:[::1]:54581 37INFO:root:Injecting error to RPC from ipv6:[::1]:54581 38INFO:root:Successfully responding to RPC from ipv6:[::1]:54581 39INFO:root:Injecting error to RPC from ipv6:[::1]:55474 40INFO:root:Injecting error to RPC from ipv6:[::1]:55474 41INFO:root:Injecting error to RPC from ipv6:[::1]:55474 42INFO:root:Injecting error to RPC from ipv6:[::1]:55474 43INFO:root:Successfully responding to RPC from ipv6:[::1]:55474 44INFO:root:Injecting error to RPC from ipv6:[::1]:55533 45INFO:root:Injecting error to RPC from ipv6:[::1]:55533 46INFO:root:Injecting error to RPC from ipv6:[::1]:55533 47INFO:root:Successfully responding to RPC from ipv6:[::1]:55533 48``` 49