Last active
January 1, 2020 14:53
-
-
Save pfreixes/08086d17fe8357b1b75cee5aac20d561 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import asyncio | |
import grpc | |
from grpc.experimental import aio | |
from proto import echo_pb2 | |
from proto import echo_pb2_grpc | |
async def run_sync_request(loop): | |
aio.init_grpc_aio() | |
channel = grpc.insecure_channel("127.0.0.1:50051") | |
stub = echo_pb2_grpc.EchoStub(channel) | |
response = stub.Hi(echo_pb2.EchoRequest(message="ping")) | |
assert response | |
print("eureka") | |
if __name__ == '__main__': | |
loop = asyncio.get_event_loop() | |
loop.run_until_complete(run_sync_request(loop)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment