Exemple #1
0
def run():
    channel = grpc.insecure_channel('localhost:50051')
    stub = cameramap_pb2_grpc.CameramapStub(channel)
    dictt = {'api': 'douban_movie', 'domain': 'movie', 'time': '163ms'}
    listt = [{"name": "dragon", "rating": 7.8, "year": "2000"}]
    dictt["res"] = str(listt)
    response = stub.SayHello(cameramap_pb2.HelloRequest(mapfield=dictt))
    print("Greeter client received: " + response.message)
Exemple #2
0
def run():
    channel = grpc.insecure_channel('localhost:50051')
    stub = cameramap_pb2_grpc.CameramapStub(channel)
    #dictt = {'Name': 'Zara', 'Age': '7', 'Class': 'First'}
    listt = ["1", "2", "3"]
    # changing list to a string
    #dictt["list"] = str(listt)
    response = stub.SayHello(cameramap_pb2.HelloRequest(datatest=listt))
    print("Greeter client received: " + response.message)
Exemple #3
0
def run():
    channel = grpc.insecure_channel('localhost:50051')
    stub = cameramap_pb2_grpc.CameramapStub(channel)
    dictt = {'api': 'douban_movie', 'domain': 'movie', 'time': '163ms'}
    listt = {"name": "dragon", "rating": 7.8, "year": "2000"}
    listts = []
    listts.append(json.dumps(listt))
    listt1 = {"name": "dragon1", "rating": 2.8, "year": "2001"}
    listts.append(json.dumps(listt1))
    response = stub.SayHello(
        cameramap_pb2.HelloRequest(mapfield=dictt, res=listts))
    print("Greeter client received: " + response.message)
Exemple #4
0
def run():
    #channel = grpc.insecure_channel('localhost:50051')
    channel = grpc.insecure_channel('dotnetcoresample.service:50051')
    #channel = grpc.insecure_channel('dotnetcoresample.service')
    stub = cameramap_pb2_grpc.CameramapStub(channel)
    data = []
    data.append({'Name': 'Zara', 'Age': '7', 'Class': 'First'})
    data.append({'Name': 'Zara1', 'Age': '71', 'Class': 'First1'})
    dictt = {"data": str(data)}

    #a = [{'Name': 'Zara', 'Age': '7', 'Class': 'First'}, {'Name': 'Zara1', 'Age': '71', 'Class': 'First1'}]

    # changing list to a string
    #dictt["list"] = str(listt)
    response = stub.SayHello(cameramap_pb2.HelloRequest(mapfield=dictt))
    #response = stub.SayHello(bb)
    print("Greeter client received: " + response.message)
Exemple #5
0
def run():
    channel = grpc.insecure_channel('localhost:50051')
    stub = cameramap_pb2_grpc.CameramapStub(channel)
    dictt = {'api': 'douban_movie', 'domain': 'movie', 'time': '163ms'}

    s1 = cameramap_pb2.ResData(name="haha", rating=9.9, year="2017")
    s2 = cameramap_pb2.ResData(name="haha1", rating=9.99, year="2017")
    # it is allowed for the following way
    tmp = {}
    tmp["name"] = "haha2"
    tmp["rating"] = 9.342
    tmp["year"] = "2017"

    s = []
    s.append(s1)
    s.append(s2)
    s.append(tmp)

    hq = cameramap_pb2.HelloRequest(mapfield=dictt, res=s)
    response = stub.SayHello(hq)
    print("Greeter client received: " + response.message)
Exemple #6
0
def run():
    channel = grpc.insecure_channel('localhost:50051')
    stub = cameramap_pb2_grpc.CameramapStub(channel)
    dictt = {'Name': 'Zara', 'Age': '7', 'Class': 'First'}
    response = stub.SayHello(cameramap_pb2.HelloRequest(mapfield=dictt))
    print("Greeter client received: " + response.message)
Exemple #7
0
def run():
    channel = grpc.insecure_channel('localhost:50051')
    stub = cameramap_pb2_grpc.CameramapStub(channel)

    response = stub.SayHello(cameramap_pb2.HelloRequest(name='you'))
    print("Greeter client received: " + response.message)