Skip to content

Commit c4e854e

Browse files
theunkn0wn1abn
andauthored
Apply suggestions from code review
Optimized imports, store RPC call result before printing Co-authored-by: Arun Babu Neelicattu <arun.neelicattu@gmail.com>
1 parent 66bdec5 commit c4e854e

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,15 +154,17 @@ service Echo {
154154

155155
A client can be implemented as follows:
156156
```python
157+
import asyncio
157158
import echo
159+
158160
from grpclib.client import Channel
159-
import asyncio
160161

161162

162163
async def main():
163164
channel = Channel(host="127.0.0.1", port=50051)
164165
service = echo.EchoStub(channel)
165-
print(await service.echo(value="hello", extra_times=1))
166+
response = await service.echo(value="hello", extra_times=1)
167+
print(response)
166168

167169
async for response in service.echo_stream(value="hello", extra_times=1):
168170
print(response)

0 commit comments

Comments
 (0)