import asyncio

from grpclib.client import Channel

# generated by protoc
from .helloworld_pb2 import HelloRequest, HelloReply
from .helloworld_grpc import GreeterStub, GreeterDBStub


async def SendRequest(channel):
    greeter = GreeterStub(channel)

    reply = await greeter.SayHello(HelloRequest(name='Mr. Easy'))
    print(reply.message)

    channel.close()

async def SendRequestDb(channel):
    greeter = GreeterDBStub(channel)

    reply = await greeter.SayHello(HelloRequest(name='Mr. PostgreSQL'))
    print(reply.message)

    channel.close()

