Exemplo n.º 1
0
def allProfile():
    channel = grpc.insecure_channel(
        "192.168.1.174:63121")  #192.168.1.174:63121    testing2.botg.rpc:80
    stub = service_pb2_grpc.PositionProfileStub(channel)
    # // 来源ID-标记业务端
    # int32 src_id = 1;
    # // 业务端自生成的UUID
    # string uuid = 2;
    # // 筛选项-职能
    # string job_func = 3;
    # // 筛选项-地区
    # int32 plc_id = 4;
    # // 筛选项-工作年限
    # nlpPositionProfile.WorkDuraType work_dura = 5;
    # // JD 可选项
    # nlpPositionProfile.JobDescription jd = 6;
    dic = {
        "description": "1. 计算机相关专业本科以上学历,拥有3年以上端游或手游开发经验",
        "requirement": "1. 基于cocos2dx开发手游客户端框架"
    }
    response = stub.GenProfile(
        service_pb2.GenPositionProfileRequest(src_id=99,
                                              uuid='lp' + str(random1),
                                              job_func='软件工程师',
                                              plc_id=1000105,
                                              jd=dic))
    print(response)
Exemplo n.º 2
0
def getProfile(env="test"):
    # channel = grpc.insecure_channel("192.168.1.174:63121")  #testing2.botg.rpc:80
    url = ''
    if env == 'test':
        with open('server.crt', 'rb') as f:
            root_cert = f.read()
        url = 'position_profile.testing2.bot.grpc:51812'
    elif env == 'prod':
        with open('server(xs).crt', 'rb') as f:
            root_cert = f.read()
        url = 'position_profile.bot.grpc:51812'
    creds = grpc.ssl_channel_credentials(root_cert)
    channel = grpc.secure_channel(
        url, creds
    )  # port:51812  测试环境position_profile.testing2.bot.grpc   开发环境   position_profile.dev.bot.grpc
    stub = service_pb2_grpc.PositionProfileStub(channel)
    # // 来源ID-标记业务端
    # int32 src_id = 1;
    # // 业务端自生成的UUID
    # repeated string uuids = 2;
    response = stub.GetProfile(
        service_pb2.GetPositionProfileRequest(
            src_id=99, uuids=["lp92540613", "lp91239964"]))
    response_dict = json_format.MessageToDict(
        response.results,
        including_default_value_fields=False,
        use_integers_for_enums=True,
        preserving_proto_field_name=True)
    response_json = json.dumps(response_dict,
                               indent=4,
                               ensure_ascii=False,
                               sort_keys=True)
    print(response_json)
Exemplo n.º 3
0
def genFullProfile():
    channel = grpc.insecure_channel("testing2.botg.rpc:80")
    stub = service_pb2_grpc.PositionProfileStub(channel)
    # // 来源ID-标记业务端
    # int32 src_id = 1;
    # // 业务端自生成的UUID
    # string uuid = 2;
    reponse = stub.GenFullProfile(service_pb2.GenFullProfileRequest())
    print(reponse)
Exemplo n.º 4
0
def getProfile():
    channel = grpc.insecure_channel(
        "192.168.1.174:63121")  #testing2.botg.rpc:80
    stub = service_pb2_grpc.PositionProfileStub(channel)
    # // 来源ID-标记业务端
    # int32 src_id = 1;
    # // 业务端自生成的UUID
    # repeated string uuids = 2;
    reponse = stub.GetProfile(
        service_pb2.GetPositionProfileRequest(src_id=1, uuids=["111"]))
    print(reponse)
Exemplo n.º 5
0
def fixFirstProfile():
    channel = grpc.insecure_channel("testing2.botg.rpc:80")
    stub = service_pb2_grpc.PositionProfileStub(channel)
    # // 来源ID-标记业务端
    # int32 src_id = 1;
    # // 业务端自生成的UUID
    # string uuid = 2;
    # // 一级维度画像-修正项-全量覆盖
    # profile.Axis1Profile axis1_profile = 3;
    reponse = stub.FixAxis1Profile(
        service_pb2.FixAxis1PositionProfileRequest())
    print(reponse)
Exemplo n.º 6
0
def firstProfile(env="test"):
    # channel = grpc.insecure_channel("testing2.botg.rpc:80")     这是没有加证书的调用  #192.168.1.174:63121    testing2.botg.rpc:80
    url = ''
    if env == 'test':
        with open('server.crt', 'rb') as f:
            root_cert = f.read()
        url = 'position_profile.testing2.bot.grpc:51812'
    elif env == 'prod':
        with open('server(xs).crt', 'rb') as f:
            root_cert = f.read()
        url = 'position_profile.bot.grpc:51812'
    creds = grpc.ssl_channel_credentials(root_cert)
    channel = grpc.secure_channel(
        url, creds
    )  # port:51812  测试环境position_profile.testing2.bot.grpc   开发环境   position_profile.dev.bot.grpc
    stub = service_pb2_grpc.PositionProfileStub(channel)
    # // 来源ID-标记业务端
    # int32 src_id = 1;
    # // 业务端自生成的UUID
    # string uuid = 2;
    # // 筛选项-职能
    # string job_func = 3;
    # // 筛选项-地区
    # int32 plc_id = 4;
    # // 筛选项-工作年限
    # nlpPositionProfile.WorkDuraType work_dura = 5;
    # // JD 可选项
    # nlpPositionProfile.JobDescription jd = 6;
    # start =time.clock()
    response = stub.GenAxis1Profile(
        service_pb2.GenAxis1PositionProfileRequest(
            src_id=99,
            uuid='lp' + str(random1),
            work_dura=3,
            job_func='java架构师',
            plc_id=1000105,
            jd=profileData.jdJAVAjiagoushi))
    response_dict = json_format.MessageToDict(
        response.results,
        including_default_value_fields=False,
        use_integers_for_enums=True,
        preserving_proto_field_name=True)
    response_json = json.dumps(response_dict,
                               indent=4,
                               ensure_ascii=False,
                               sort_keys=True)
    # print(time.clock()-start)
    print(response_json)
Exemplo n.º 7
0
def firstProfile():
    channel = grpc.insecure_channel(
        "192.168.1.174:63121")  #192.168.1.174:63121    testing2.botg.rpc:80
    stub = service_pb2_grpc.PositionProfileStub(channel)
    # // 来源ID-标记业务端
    # int32 src_id = 1;
    # // 业务端自生成的UUID
    # string uuid = 2;
    # // 筛选项-职能
    # string job_func = 3;
    # // 筛选项-地区
    # int32 plc_id = 4;
    # // 筛选项-工作年限
    # nlpPositionProfile.WorkDuraType work_dura = 5;
    # // JD 可选项
    # nlpPositionProfile.JobDescription jd = 6;
    reponse = stub.GenAxis1Profile(
        service_pb2.GenAxis1PositionProfileRequest(src_id=99,
                                                   uuid='lp' + str(random1),
                                                   job_func='软件工程师',
                                                   plc_id=1000105,
                                                   jd={}))
    print(reponse)
Exemplo n.º 8
0
def fixFirstProfile(env="test"):
    # channel = grpc.insecure_channel("testing2.botg.rpc:80")
    url = ''
    if env == 'test':
        with open('server.crt', 'rb') as f:
            root_cert = f.read()
        url = 'position_profile.testing2.bot.grpc:51812'
    elif env == 'prod':
        with open('server(xs).crt', 'rb') as f:
            root_cert = f.read()
        url = 'position_profile.bot.grpc:51812'
    creds = grpc.ssl_channel_credentials(root_cert)
    channel = grpc.secure_channel(
        url, creds
    )  # port:51812  测试环境position_profile.testing2.bot.grpc   开发环境   position_profile.dev.bot.grpc
    stub = service_pb2_grpc.PositionProfileStub(channel)
    # // 来源ID-标记业务端
    # int32 src_id = 1;
    # // 业务端自生成的UUID
    # string uuid = 2;
    # // 一级维度画像-修正项-全量覆盖
    # profile.Axis1Profile axis1_profile = 3;
    response = stub.FixAxis1Profile(
        service_pb2.FixAxis1PositionProfileRequest(src_id=99,
                                                   uuid="lp92540613",
                                                   axis1_profile={}))
    response_dict = json_format.MessageToDict(
        response.results,
        including_default_value_fields=False,
        use_integers_for_enums=True,
        preserving_proto_field_name=True)
    response_json = json.dumps(response_dict,
                               indent=4,
                               ensure_ascii=False,
                               sort_keys=True)
    print(response_json)