示例#1
0
def run():
    channel = grpc.insecure_channel('localhost:50051')
    stub = helloworld_pb2.GreeterStub(channel)
    #response = stub.SayHello(helloworld_pb2.HelloRequest(name='you'))
    #print("Greeter client received: " + response.message)
    response = stub.getUas(helloworld_pb2.UasIdentifier(identifier=666))
    print("Mode is: " + response.mode)
示例#2
0
def run():
    channel = grpc.insecure_channel('localhost:8080')
    stub = helloworld_pb2.GreeterStub(channel)
    response = stub.SayHello(helloworld_pb2.HelloRequest(name='me'))
    print("===============================================")
    print("Greeter client received: " + response.message)
    print("===============================================")
示例#3
0
def run():

  creds = grpc.ssl_channel_credentials(
      open('priv/ansible/roles/grpcexperiments/templates/server.crt').read())
  channel = grpc.secure_channel('localhost:50052', creds)
  stub = helloworld_pb2.GreeterStub(channel)
  result = stub.SayHello(helloworld_pb2.HelloRequest(name='you'))
  print(result)
示例#4
0
def run():
    if len(sys.argv) >= 2:
        grpc_server = sys.argv[1]
    else:
        grpc_server = 'localhost:50051'
    channel = grpc.insecure_channel(grpc_server)
    stub = helloworld_pb2.GreeterStub(channel)
    response = stub.SayHello(helloworld_pb2.HelloRequest(name='aaaaaaaaaaa'))
    print("Greeter client received: " + response.message)
示例#5
0
def run():
    channel = grpc.insecure_channel('localhost:50051')
    greeter_stub = helloworld_pb2.GreeterStub(channel)
    route_guide_stub = route_guide_pb2.RouteGuideStub(channel)
    greeter_response = greeter_stub.SayHello(
        helloworld_pb2.HelloRequest(name='you'))
    print("Greeter client received: " + greeter_response.message)
    print("-------------- GetFeature --------------")
    guide_get_feature(route_guide_stub)
    print("-------------- ListFeatures --------------")
    guide_list_features(route_guide_stub)
    print("-------------- RecordRoute --------------")
    guide_record_route(route_guide_stub)
    print("-------------- RouteChat --------------")
    guide_route_chat(route_guide_stub)
示例#6
0
import grpc
import helloworld_pb2

with open('roots.pem', 'rb') as f:
    creds = grpc.ssl_channel_credentials(f.read())
    channel = grpc.secure_channel('myservice.example.com:443', creds)
    stub = helloworld_pb2.GreeterStub(channel)
def run():
  channel = grpc.insecure_channel('faille.io:50051')
  stub = helloworld_pb2.GreeterStub(channel)
  response = stub.SayHello(helloworld_pb2.HelloRequest(name='you'))
  print("Greeter client received: " + response.message)