예제 #1
0
 def request_messages():
     for i in range(100):
         request = demo_pb2.Request(
             client_id=CLIENT_ID,
             request_data=("Chamada pelo cliente Python, Mensagem: %d" % i))
         yield request
         time.sleep(1)
예제 #2
0
파일: client.py 프로젝트: azadious/gRPC
 def request_messages():
     for i in range(5):
         request = demo_pb2.Request(
             client_id=CLIENT_ID,
             request_data=("called by Python client, message: %d" % i))
         yield request
         time.sleep(1)
예제 #3
0
파일: client.py 프로젝트: Isabellarossi/sbd
def simple_method(stub):
    print("--------------Call SimpleMethod Begin--------------")
    request = demo_pb2.Request(client_id=CLIENT_ID, request_data="check")
    response = stub.SimpleMethod(request)
    print("resp from server(%d), the message=%s" %
          (response.server_id, response.response_data))
    print("--------------Call SimpleMethod Over---------------")
예제 #4
0
def simple_method(stub):
    print("//--------------INICIANDO LIGACAO : SIMPLES :--------//")
    request = demo_pb2.Request(client_id=CLIENT_ID,
                               request_data="Chamada pelo cliente Python")
    response = stub.SimpleMethod(request)
    print("Resposta Servidor(%d), A Mensagem =%s" %
          (response.server_id, response.response_data))
    print("//--------------FINALIZANDO LIGACAO---------------//")
예제 #5
0
파일: client.py 프로젝트: Isabellarossi/sbd
def server_streaming_method(stub):
    print("--------------Call ServerStreamingMethod Begin--------------")
    request = demo_pb2.Request(client_id=CLIENT_ID, request_data="start")
    response_iterator = stub.ServerStreamingMethod(request)
    for response in response_iterator:
        print("recv from server(%d), message=%s" %
              (response.server_id, response.response_data))

    print("--------------Call ServerStreamingMethod Over---------------")
예제 #6
0
def server_streaming_method(stub):
    print("//--------------INICIANDO LIGACAO : SERVIDOR STREAMING :--------------//")
    request = demo_pb2.Request(client_id=CLIENT_ID,
                               request_data="Chamada pelo cliente Python")
    response_iterator = stub.ServerStreamingMethod(request)
    for response in response_iterator:
        print("Resposta Servidor(%d), A Mensagem =%s" %
              (response.server_id, response.response_data))
    print("//--------------FINALIZANDO LIGACAO---------------//")
예제 #7
0
def simple_method(stub):
    #Uploading file
    in_file_name = 'C:\Users\usuario\Documents\Dev\gRPC-Python\data_transmission\uploading\file.parquet'
    client.upload(in_file_name)

    #Downloading file
    out_file_name = 'C:\Users\usuario\Documents\Dev\gRPC-Python\data_transmission\downloading\file.parquet'
    if os.path.exists(out_file_name):
       os.remove(out_file_name)
    client.download('whatever_name', out_file_name)
    os.system(f'sha1sum {in_file_name}')
    os.system(f'sha1sum {out_file_name}')

    print("//--------------INICIANDO LIGACAO : SIMPLES :--------//")
    request = demo_pb2.Request(client_id=CLIENT_ID,
                               request_data="Chamada pelo cliente Python")
    response = stub.SimpleMethod(request)
    print("Resposta Servidor(%d), A Mensagem =%s" %
          (response.server_id, response.response_data))
    print("//--------------FINALIZANDO LIGACAO---------------//")
예제 #8
0
파일: client.py 프로젝트: Isabellarossi/sbd
 def request_messages():
     for i in range(5):
         request = demo_pb2.Request(
             client_id=CLIENT_ID,
             request_data=("called by Python client, message:%d" % i))
         return request