예제 #1
0
def runUserSubmit(uid, hk):
    with grpc.insecure_channel('0.0.0.0:50051') as channel:
        stub = flagging_pb2_grpc.PhotoFlaggingStub(channel)
        response = stub.UserSubmit(
            flagging_pb2.UserSubmitRequest(userId=uid, hashKey=hk))
        result = {'rejected': response.rejected, 'existed': response.existed}
        return result
예제 #2
0
def runAdminRequest(uid):
    with grpc.insecure_channel('0.0.0.0:50051') as channel:
        stub = flagging_pb2_grpc.PhotoFlaggingStub(channel)
        response = stub.AdminRequest(
            flagging_pb2.AdminRequestRequest(userId=uid))
        result = {}
        ##create the output dictionary hash is the key, flag is the value
        for h, f in zip(response.hashKeyList, response.flaggedList):
            result[h] = f
        return result
예제 #3
0
def runUserRequest(uid):
    with grpc.insecure_channel('0.0.0.0:50051') as channel:
        stub = flagging_pb2_grpc.PhotoFlaggingStub(channel)
        response = stub.UserRequest(
            flagging_pb2.UserRequestRequest(userId=uid))
        return response.unflaggedHash