コード例 #1
0
ファイル: downloadfile.py プロジェクト: nevermorer1/NEMO
 def base_download_public_history(self,
                                  para_id,
                                  data_id,
                                  cookies,
                                  flag=True):
     """历史记录—(批量)下载excel"""
     # 获取请求url
     url_download_task = self.domain + Base.dh.get_path(para_id)
     Log.info('download_public_history request url : {}'.format(
         url_download_task))
     # 获取请求数据
     data_source = self.dh.get_data(data_id)
     req_para = Base.get_req_para(para_id=para_id, data_id=data_id)
     # 查找task id
     req_para['taskIdList'] = self.get_history_task_id(
         eval(req_para['taskIdList']))
     data_source[0][5] = req_para['taskIdList']
     Log.info('download_public_history request data is {}'.format(req_para))
     # 请求
     res = requests.post(url=url_download_task,
                         headers=Base.headers,
                         cookies=cookies,
                         data=Base.sign(req_para))
     Log.info('download_public_history response data is {}'.format(
         res.status_code))
     # 结果检查
     actual = self.new_check(res, flag)
     # 结果写入
     DataHandle.set_data(data_source[0], actual)
     self.dh.write_data(data_source)
     # 结果检查
     return self.dh.check_result(data_source)
コード例 #2
0
ファイル: downloadfile.py プロジェクト: nevermorer1/NEMO
 def base_download_log_file(self, para_id, data_id, cookies, flag=True):
     """日志部分-下载log文件"""
     # 获取请求url
     url_download_task = self.domain + Base.dh.get_path(para_id)
     Log.info(
         'download_log_file request url : {}'.format(url_download_task))
     # 获取请求数据
     data_source = self.dh.get_data(data_id)
     req_para = Base.get_req_para(para_id=para_id, data_id=data_id)
     # 查找task id
     req_para['userId'] = self.get_user_id(req_para['userId'])
     data_source[0][5] = req_para['userId']
     Log.info('download_log_file request data is {}'.format(req_para))
     # 请求
     res = requests.post(url=url_download_task,
                         headers=Base.headers,
                         cookies=cookies,
                         data=Base.sign(req_para))
     Log.info('download_log_file response data is {}'.format(
         res.status_code))
     # 结果检查
     actual = self.new_check(res, flag)
     # 结果写入
     DataHandle.set_data(data_source[0], actual)
     self.dh.write_data(data_source)
     # 结果检查
     return self.dh.check_result(data_source)
コード例 #3
0
ファイル: caculget.py プロジェクト: nevermorer1/NEMO
 def base_get_detail_by_accept(self, para_id, data_id, cookies):
     """协同计算-查询详情公共方法"""
     # 获取请求url
     url_get_detail_by_accept = self.domain + Base.dh.get_path(para_id)
     Log.info('get_detail_by_accept request url : {}'.format(
         url_get_detail_by_accept))
     # 获取请求数据
     data_source = self.dh.get_data(data_id)
     req_para = Base.get_req_para(para_id=para_id, data_id=data_id)
     # 查询数据库taskId,随机选择查询
     req_para['taskId'] = self.get_task_id()
     data_source[0][5] = req_para['taskId']
     Log.info('get_detail_by_accept request data is {}'.format(req_para))
     # 请求
     res = requests.post(url=url_get_detail_by_accept,
                         headers=Base.headers,
                         cookies=cookies,
                         data=Base.sign(req_para)).json()
     Log.info('get_detail_by_accept response data is {}'.format(res))
     # 结果检查
     actual = self.get_detail_by_accept_check(req_para['taskId'], res)
     # 结果写入
     DataHandle.set_data(data_source[0], actual)
     self.dh.write_data(data_source)
     # 结果检查
     return self.dh.check_result(data_source)
コード例 #4
0
ファイル: userinfo.py プロジェクト: nevermorer1/NEMO
 def base_update_user(self, para_id, data_id, cookies):
     """修改用户公共方法"""
     # 获取请求url
     url_update = self.domain + Base.dh.get_path(para_id)
     Log.info('update user request url : {}'.format(url_update))
     # 获取请求数据
     data_source = self.dh.get_data(data_id)
     req_para = Base.get_req_para(para_id=para_id, data_id=data_id)
     # 随机生成用户名
     req_para['userId'] = self.s.select_dic_single(
         self.sql_select_update)['id']
     data_source[0][5] = req_para['userId']
     # 接口数据类型转换
     req_para['group'] = eval(req_para['group'])
     req_para['status'] = eval(req_para['status'])
     Log.info('update user request data is {}'.format(json.dumps(req_para)))
     # 检查数据库
     self.before_update()
     # 请求接口
     res = requests.post(url=url_update,
                         headers=Base.headers,
                         cookies=cookies,
                         data=Base.sign(req_para)).json()
     Log.info('update user response data is {}'.format(res))
     # 结果检查
     actual = self.after_update_check(res=res, status=req_para['status'])
     # 结果写入
     DataHandle.set_data(data_source[0], actual)
     self.dh.write_data(data_source)
     # 结果检查
     return self.dh.check_result(data_source)
コード例 #5
0
ファイル: userinfo.py プロジェクト: nevermorer1/NEMO
 def base_insert_user(self, para_id, data_id, cookies):
     """新增用户公共方法"""
     # 获取请求url
     url_insert = self.domain + Base.dh.get_path(para_id)
     Log.info('insert user request url : {}'.format(url_insert))
     # 获取请求数据
     data_source = self.dh.get_data(data_id)
     req_para = Base.get_req_para(para_id=para_id, data_id=data_id)
     # 随机生成用户名
     req_para['loginName'] = self.gene_username()
     data_source[0][5] = req_para['loginName']
     req_para['name'] = self.gene_username()
     data_source[0][6] = req_para['name']
     # 接口数据类型转换
     req_para['group'] = eval(req_para['group'])
     req_para['status'] = eval(req_para['status'])
     Log.info('insert user request data is {}'.format(json.dumps(req_para)))
     # 请求接口
     res = requests.post(url=url_insert,
                         headers=Base.headers,
                         cookies=cookies,
                         data=Base.sign(req_para)).json()
     Log.info('insert user response data is {}'.format(res))
     # 结果检查
     actual = self.check(res)
     # 结果写入
     DataHandle.set_data(data_source[0], actual)
     self.dh.write_data(data_source)
     # 结果检查
     return self.dh.check_result(data_source)
コード例 #6
0
ファイル: userinfo.py プロジェクト: nevermorer1/NEMO
 def base_modify_password(self, para_id, data_id, cookies):
     """用户修改密码公共方法"""
     # 获取请求url
     url_modify = self.domain + Base.dh.get_path(para_id)
     Log.info('insert user request url : {}'.format(url_modify))
     # 获取请求数据,md5
     data_source = self.dh.get_data(data_id)
     req_para = Base.get_req_para(para_id=para_id, data_id=data_id)
     req_para['userId'] = self.get_user_id()
     data_source[0][5] = req_para['userId']
     req_para['password'] = Base.make_password(req_para['password'])
     req_para['newPassword'] = Base.make_password(req_para['newPassword'])
     Log.info('modify_password data is {}'.format(req_para))
     # 请求前数据库检查
     self.before_modify_check()
     # 请求
     res = requests.post(url=url_modify,
                         headers=Base.headers,
                         cookies=cookies,
                         data=Base.sign(req_para)).json()
     Log.info('modify_password response data is {}'.format(res))
     # 结果检查
     actual = self.modify_check(res)
     # 结果写入
     DataHandle.set_data(data_source[0], actual)
     self.dh.write_data(data_source)
     # 结果检查
     return self.dh.check_result(data_source)
コード例 #7
0
ファイル: historytest.py プロジェクト: nevermorer1/NEMO
 def base_get_list(self, para_id, data_id, cookies, flag):
     """历史记录--查询协同计算列表公共方法"""
     # 获取请求url
     url_get_list = self.domain + Base.dh.get_path(para_id)
     Log.info('get_list request url : {}'.format(url_get_list))
     # 获取请求数据
     data_source = self.dh.get_data(data_id)
     req_para = Base.get_req_para(para_id=para_id, data_id=data_id)
     # 请求数据转换
     for key in req_para.keys():
         if key == 'remark' or key == 'target':
             pass
         elif req_para[key] == '':
             pass
         else:
             req_para[key] = eval(req_para[key])
     Log.info('get_list request data is {}'.format(req_para))
     # 请求
     res = requests.post(url=url_get_list,
                         headers=Base.headers,
                         cookies=cookies,
                         data=Base.sign(req_para)).json()
     Log.info('get_list response data is {}'.format(res))
     # 结果检查
     actual = self.get_list_check(res, flag)
     # 结果写入
     DataHandle.set_data(data_source[0], actual)
     self.dh.write_data(data_source)
     # 结果检查
     return self.dh.check_result(data_source)
コード例 #8
0
ファイル: userinfo.py プロジェクト: nevermorer1/NEMO
 def base_reset_password(self, para_id, data_id, cookies):
     """admin重置用户密码"""
     # 获取请求url
     url_reset = self.domain + Base.dh.get_path(para_id)
     Log.info('reset_password url is {}'.format(url_reset))
     # 获取请求数据
     data_source = self.dh.get_data(data_id)
     req_para = Base.get_req_para(para_id=para_id, data_id=data_id)
     sql = 'SELECT id FROM t_user WHERE loginName = \'Automation\''
     # 设置 userid
     req_para['userId'] = self.s.select_single(sql)
     data_source[0][5] = req_para['userId']
     Log.info('reset_password data is {}'.format(req_para))
     # 请求前数据库检查
     self.before_reset()
     # 请求接口
     res = requests.post(url=url_reset,
                         headers=Base.headers,
                         cookies=cookies,
                         data=Base.sign(req_para)).json()
     Log.info('reset_password response data is {}'.format(res))
     # 结果检查
     actual = self.after_reset_check(res)
     # 结果写入
     DataHandle.set_data(data_source[0], actual)
     self.dh.write_data(data_source)
     # 结果检查
     return self.dh.check_result(data_source)
コード例 #9
0
ファイル: userinfo.py プロジェクト: nevermorer1/NEMO
    def base_get_user_by_id(self, para_id, data_id, cookies):
        """查询用户详情"""
        # 获取请求url
        url_get_user_by_id = self.domain + Base.dh.get_path(para_id)
        Log.info('get_user_by_id request url : {}'.format(url_get_user_by_id))

        # 获取请求数据
        data_source = self.dh.get_data(data_id)
        req_para = Base.get_req_para(para_id=para_id, data_id=data_id)
        sql = 'SELECT id FROM t_user WHERE loginName = \'Automation\''
        # 设置 userid
        req_para['userId'] = self.s.select_single(sql)
        data_source[0][5] = req_para['userId']
        Log.info('get_user_by_id request data : {}'.format(req_para))
        # 请求
        res = requests.post(url=url_get_user_by_id,
                            headers=Base.headers,
                            cookies=cookies,
                            data=Base.sign(req_para)).json()
        Log.info('get_user_by_id response data is {}'.format(res))
        # 结果检查
        actual = self.check(res)
        # 结果写入
        DataHandle.set_data(data_source[0], actual)
        self.dh.write_data(data_source)
        # 结果检查
        return self.dh.check_result(data_source)
コード例 #10
0
ファイル: caculget.py プロジェクト: nevermorer1/NEMO
 def base_get_list_by_accept(self, para_id, data_id, cookies):
     """查询协同计算列表公共方法"""
     # 获取请求url
     url_get_list_by_accept = self.domain + Base.dh.get_path(para_id)
     Log.info('get_list_by_accept request url : {}'.format(
         url_get_list_by_accept))
     # 获取请求数据
     data_source = self.dh.get_data(data_id)
     req_para = Base.get_req_para(para_id=para_id, data_id=data_id)
     # 请求数据转换
     if not req_para['calType'] == '':
         req_para['calType'] = eval(req_para['calType'])
     req_para['pageNo'] = eval(req_para['pageNo'])
     req_para['pageSize'] = eval(req_para['pageSize'])
     Log.info('get_list_by_accept request data is {}'.format(req_para))
     # 请求
     res = requests.post(url=url_get_list_by_accept,
                         headers=Base.headers,
                         cookies=cookies,
                         data=Base.sign(req_para)).json()
     Log.info('get_list_by_accept response data is {}'.format(res))
     # 结果检查
     actual = self.get_list_by_accept_check(res)
     # 结果写入
     DataHandle.set_data(data_source[0], actual)
     self.dh.write_data(data_source)
     # 结果检查
     return self.dh.check_result(data_source)
コード例 #11
0
 def base_get_gwasgen_cal_result(self, para_id, data_id, cookies, flag):
     """历史记录-查询GWAS-基因型计算结果公共方法"""
     # 获取请求url
     url_get_gwasgen_cal_result = self.domain + Base.dh.get_path(para_id)
     Log.info('get_gwasgen_maf_result request url : {}'.format(
         url_get_gwasgen_cal_result))
     # 获取请求数据
     data_source = self.dh.get_data(data_id)
     req_para = Base.get_req_para(para_id=para_id, data_id=data_id)
     # 查询数据库taskId,随机选择查询
     req_para['taskId'] = self.get_gwasgen_done_task_id()
     req_para['pageNo'] = eval(req_para['pageNo'])
     req_para['pageSize'] = eval(req_para['pageSize'])
     data_source[0][5] = req_para['taskId']
     # 数据库查询taskId为空处理
     if req_para['taskId'] is None:
         actual = not flag
         Log.error('数据库查询taskId为空,该用例未执行,失败')
     else:
         Log.info(
             'get_gwasgen_cal_result request data is {}'.format(req_para))
         # 请求
         res = requests.post(url=url_get_gwasgen_cal_result,
                             headers=Base.headers,
                             cookies=cookies,
                             data=Base.sign(req_para)).json()
         Log.info('get_gwasgen_cal_result response data is {}'.format(res))
         # 结果检查
         actual = self.get_gwasgen_result_check(req_para['taskId'], res,
                                                flag)
     # 结果写入
     DataHandle.set_data(data_source[0], actual)
     self.dh.write_data(data_source)
     # 结果检查
     return self.dh.check_result(data_source)
コード例 #12
0
ファイル: caculgen.py プロジェクト: nevermorer1/NEMO
    def base_gen_status(self, para_id, data_id, cookies):
        """gen start gen计算发起.状态一致测试"""
        # 获取请求url
        url_gen_start = self.domain + Base.dh.get_path(para_id)
        Log.info('gen_start request url : {}'.format(url_gen_start))
        # 获取请求数据
        data_source = self.dh.get_data(data_id)
        req_para = Base.get_req_para(para_id=para_id, data_id=data_id)

        # fileList 字符串转列表
        req_para['fileList'] = eval(req_para['fileList'])

        req_para['fileList'] = self.gene_file_id_list(req_para['fileList'],
                                                      cookies)
        data_source[0][5] = req_para['fileList']

        # top 数据转换
        req_para['top'] = eval(req_para['top'])
        req_para['isPrint'] = eval(req_para['isPrint'])
        Log.info('gen_start request data is {}'.format(req_para))
        # 请求
        res = requests.post(url=url_gen_start,
                            headers=Base.headers,
                            cookies=cookies,
                            data=Base.sign(req_para)).json()
        Log.info('gen_start response data is {}'.format(res))
        # 结果检查
        status = eval(data_source[0][3])
        actual = self.gen_status_check(res, status)
        # 结果写入
        DataHandle.set_data(data_source[0], actual)
        self.dh.write_data(data_source)
        # 结果检查
        return self.dh.check_result(data_source)
コード例 #13
0
ファイル: computegwas.py プロジェクト: nevermorer1/NEMO
    def base_compute_gwas(self,
                          para_id,
                          data_id,
                          cookies,
                          calType=3,
                          maxFile=0):
        """vcf协同计算  calType:1 随机查找vcf task ; 2 查找基因协同计算任务 3 GWAS 0 查找最大id+6666"""
        # 获取请求url
        url_compute_gwas = self.domain + Base.dh.get_path(para_id)
        Log.info('compute_gwas request url : {}'.format(url_compute_gwas))
        # 获取请求数据
        data_source = self.dh.get_data(data_id)
        req_para = Base.get_req_para(para_id=para_id, data_id=data_id)
        req_para['fileIdList'] = eval(req_para['fileIdList'])
        # 登录态判断
        if cookies is not None:
            # 不存在的fileid
            if maxFile:
                req_para['fileIdList'] = self.get_max_file_id()
            # fileIdList为空,不处理
            elif len(req_para['fileIdList']) == 0:
                pass
            # file文件上传获取fileIdList
            else:
                req_para['fileIdList'] = self.gene_file_id_list(
                    req_para['fileIdList'], cookies)

        # id不存在
        if not calType:
            req_para['taskId'] = self.get_max_task_id()
        else:
            req_para['taskId'] = self.get_task_id(calType)

        data_source[0][5] = req_para['taskId']
        data_source[0][6] = req_para['fileIdList']
        Log.info('compute_gwas request data is {}'.format(req_para))
        # 请求
        res = requests.post(url=url_compute_gwas,
                            headers=Base.headers,
                            cookies=cookies,
                            data=Base.sign(req_para)).json()
        Log.info('compute_gwas response data is {}'.format(res))
        # 结果检查
        actual = self.gwas_check(res)
        # 结果写入
        DataHandle.set_data(data_source[0], actual)
        self.dh.write_data(data_source)
        # 结果检查
        return self.dh.check_result(data_source)
コード例 #14
0
    def base_compute_mul(self,
                         para_id,
                         data_id,
                         cookies,
                         flag,
                         maxId=0,
                         maxFile=0):
        """vcf  批量计算"""
        # 获取请求url
        url_compute_mul = self.domain + Base.dh.get_path(para_id)
        Log.info('compute_mul request url : {}'.format(url_compute_mul))
        # 获取请求数据
        data_source = self.dh.get_data(data_id)
        req_para = Base.get_req_para(para_id=para_id, data_id=data_id)
        # 登录态判断
        if cookies is not None:
            # 不存在的fileid
            if maxFile:
                req_para['fileId'] = self.get_max_file_id()
            else:
                # file文件上传获取fileId
                req_para['fileId'] = self.gene_file_id(req_para['fileId'],
                                                       cookies)

        # taskId
        if maxId:
            req_para['taskId'] = self.get_vcf_max_task_id()
        else:
            req_para['taskId'] = self.get_vcf_task_id_list()

        data_source[0][5] = req_para['taskId']
        data_source[0][7] = req_para['fileId']
        Log.info('compute_vcf request data is {}'.format(req_para))
        # 请求
        res = requests.post(url=url_compute_mul,
                            headers=Base.headers,
                            cookies=cookies,
                            data=Base.sign(req_para)).json()
        Log.info('compute_vcf response data is {}'.format(res))
        # 结果检查
        actual = self.vcf_check(res, flag)
        # 结果写入
        DataHandle.set_data(data_source[0], actual)
        self.dh.write_data(data_source)
        # 结果检查
        return self.dh.check_result(data_source)
コード例 #15
0
ファイル: caculgen.py プロジェクト: nevermorer1/NEMO
    def base_gen_start(self, para_id, data_id, cookies, isChange=0, maxFile=0):
        """gen start gen计算发起. isChange:0读取请求数据,1 请求数据重复100遍"""
        # 获取请求url
        url_gen_start = self.domain + Base.dh.get_path(para_id)
        Log.info('gen_start request url : {}'.format(url_gen_start))
        # 获取请求数据
        data_source = self.dh.get_data(data_id)
        req_para = Base.get_req_para(para_id=para_id, data_id=data_id)
        # 登录态判断
        if cookies is not None:
            # 不存在的fileid
            if maxFile:
                req_para['fileList'] = self.get_max_file_id()
                data_source[0][5] = req_para['fileList']
            else:
                # fileList 字符串转列表
                req_para['fileList'] = eval(req_para['fileList'])
                # fileList 文件上传,获取文件id,如果文件列表为空,则跳过上传文件操作
                if len(req_para['fileList']) > 0:
                    req_para['fileList'] = self.gene_file_id_list(
                        req_para['fileList'], cookies)
                    data_source[0][5] = req_para['fileList']
                else:
                    pass
        # remark 内容
        if isChange:
            req_para['remark'] = req_para['remark'] * 100
            data_source[0][7] = req_para['remark']

        # top 数据转换
        req_para['top'] = eval(req_para['top'])
        req_para['isPrint'] = eval(req_para['isPrint'])
        Log.info('gen_start request data is {}'.format(req_para))
        # 请求
        res = requests.post(url=url_gen_start,
                            headers=Base.headers,
                            cookies=cookies,
                            data=Base.sign(req_para)).json()
        Log.info('gen_start response data is {}'.format(res))
        # 结果检查
        actual = self.gen_check(res)
        # 结果写入
        DataHandle.set_data(data_source[0], actual)
        self.dh.write_data(data_source)
        # 结果检查
        return self.dh.check_result(data_source)
コード例 #16
0
ファイル: logout.py プロジェクト: nevermorer1/NEMO
 def base_logout(self, para_id, data_id, cookies=None):
     """退出登录公共方法"""
     Log.info('logout url is %s' % self.url)
     # 获取请求数据
     data_source = self.dh.get_data(data_id)
     req_para = Base.get_req_para(para_id=para_id, data_id=data_id)
     Log.info('request data is %s' % req_para)
     # 请求接口
     res = requests.post(url=self.url, headers=Base.headers, cookies=cookies,
                         data=Base.sign(req_para)).json()
     Log.info('logout response data is {}'.format(res))
     # 结果检查
     actual = self.check(res)
     # 结果写入
     DataHandle.set_data(data_source[0], actual)
     self.dh.write_data(data_source)
     # 结果检查
     return self.dh.check_result(data_source)
コード例 #17
0
ファイル: canceltask.py プロジェクト: nevermorer1/NEMO
    def base_query_update_flag(self, para_id, data_id, cookies, flag):
        """协同计算--数据更新"""
        # 获取请求url
        url_query_update_flag = self.domain + Base.dh.get_path(para_id)
        Log.info('query_update_flag request url : {}'.format(url_query_update_flag))
        # 获取请求数据
        data_source = self.dh.get_data(data_id)
        req_para = Base.get_req_para(para_id=para_id, data_id=data_id)

        Log.info('query_update_flag request data is {}'.format(req_para))
        # 请求
        res = requests.post(url=url_query_update_flag, headers=Base.headers, cookies=cookies,
                            data=Base.sign(req_para)).json()
        Log.info('query_update_flag response data is {}'.format(res))
        # 结果检查
        actual = self.query_check(res, flag)
        # 结果写入
        DataHandle.set_data(data_source[0], actual)
        self.dh.write_data(data_source)
        # 结果检查
        return self.dh.check_result(data_source)
コード例 #18
0
ファイル: caculget.py プロジェクト: nevermorer1/NEMO
 def base_get_server(self, para_id, data_id, cookies):
     """协同计算--查询服务器公共方法"""
     # 获取请求url
     url_get_server = self.domain + Base.dh.get_path(para_id)
     Log.info('get_server request url : {}'.format(url_get_server))
     # 获取请求数据
     data_source = self.dh.get_data(data_id)
     req_para = Base.get_req_para(para_id=para_id, data_id=data_id)
     Log.info('get_server request data is {}'.format(req_para))
     # 请求
     res = requests.post(url=url_get_server,
                         headers=Base.headers,
                         cookies=cookies,
                         data=Base.sign(req_para)).json()
     Log.info('get_server response data is {}'.format(res))
     # 结果检查
     actual = self.get_server_check(res)
     # 结果写入
     DataHandle.set_data(data_source[0], actual)
     self.dh.write_data(data_source)
     # 结果检查
     return self.dh.check_result(data_source)
コード例 #19
0
ファイル: historytest.py プロジェクト: nevermorer1/NEMO
 def base_logic_get_list(self, para_id, data_id, cookies, flag):
     """逻辑管理-查询列表"""
     # 获取请求url
     url_logic_get_list = self.domain + Base.dh.get_path(para_id)
     Log.info('logic_get_list request url : {}'.format(url_logic_get_list))
     # 获取请求数据
     data_source = self.dh.get_data(data_id)
     req_para = Base.get_req_para(para_id=para_id, data_id=data_id)
     Log.info('logic_get_list request data is {}'.format(req_para))
     # 请求
     res = requests.post(url=url_logic_get_list,
                         headers=Base.headers,
                         cookies=cookies,
                         data=Base.sign(req_para)).json()
     Log.info('logic_get_list response data is {}'.format(res))
     # 结果检查
     actual = self.get_logic_check(res, flag)
     # 结果写入
     DataHandle.set_data(data_source[0], actual)
     self.dh.write_data(data_source)
     # 结果检查
     return self.dh.check_result(data_source)
コード例 #20
0
ファイル: canceltask.py プロジェクト: nevermorer1/NEMO
    def base_cancel_task(self, para_id, data_id, cookies, flag, task_modify=0, reason_modify=0):
        """协同计算--取消任务"""
        # 获取请求url
        url_vcf_start = self.domain + Base.dh.get_path(para_id)
        Log.info('cancel_task request url : {}'.format(url_vcf_start))
        # 获取请求数据
        data_source = self.dh.get_data(data_id)
        req_para = Base.get_req_para(para_id=para_id, data_id=data_id)

        req_para['type'] = eval(req_para['type'])

        # 不存在的taskId
        if task_modify:
            temp = {'taskId': None, 'startTaskId': None}
            req_para['taskId'] = self.get_max_task_id(req_para['type'])
        else:
            # 获取请求参数,temp存储id,startTaskId组成的字典
            temp = self.get_task_id(req_para['type'])
            req_para['taskId'] = temp['id']

        # reason 内容
        if reason_modify:
            req_para['reason'] = req_para['reason'] * 100

        data_source[0][5] = req_para['taskId']
        data_source[0][7] = req_para['reason']
        Log.info('cancel_task request data is {}'.format(req_para))
        # 请求
        res = requests.post(url=url_vcf_start, headers=Base.headers, cookies=cookies,
                            data=Base.sign(req_para)).json()
        Log.info('cancel_task response data is {}'.format(res))
        # 结果检查
        actual = self.cancel_check(res, temp, flag)
        # 结果写入
        DataHandle.set_data(data_source[0], actual)
        self.dh.write_data(data_source)
        # 结果检查
        return self.dh.check_result(data_source)
コード例 #21
0
ファイル: userinfo.py プロジェクト: nevermorer1/NEMO
 def base_get_list_by_condition(self, para_id, data_id, cookies):
     """获取用户列表"""
     # 获取请求url
     url_get_list_by_condition = self.domain + Base.dh.get_path(para_id)
     Log.info('get_list_by_condition request url : {}'.format(
         url_get_list_by_condition))
     # 获取请求数据
     data_source = self.dh.get_data(data_id)
     req_para = Base.get_req_para(para_id=para_id, data_id=data_id)
     Log.info('get_list_by_condition request data is {}'.format(req_para))
     # 请求
     res = requests.post(url=url_get_list_by_condition,
                         headers=Base.headers,
                         cookies=cookies,
                         data=Base.sign(req_para)).json()
     Log.info('get_list_by_condition response data is {}'.format(res))
     # 结果检查
     actual = self.check(res)
     # 结果写入
     DataHandle.set_data(data_source[0], actual)
     self.dh.write_data(data_source)
     # 结果检查
     return self.dh.check_result(data_source)
コード例 #22
0
ファイル: userinfo.py プロジェクト: nevermorer1/NEMO
    def base_query_in_status(self, para_id, data_id, cookies):
        """本地查询用户在线状态"""
        # 获取请求url
        url_get_user_by_id = self.domain + Base.dh.get_path(para_id)
        Log.info('query_in_status request url : {}'.format(url_get_user_by_id))

        # 获取请求数据
        data_source = self.dh.get_data(data_id)
        req_para = Base.get_req_para(para_id=para_id, data_id=data_id)
        # 请求
        res = requests.post(url=url_get_user_by_id,
                            headers=Base.headers,
                            cookies=cookies,
                            data=Base.sign(req_para),
                            timeout=10).json()
        Log.info('query_in_status response data is {}'.format(res))
        # 结果检查
        actual = self.check(res)
        # 结果写入
        DataHandle.set_data(data_source[0], actual)
        self.dh.write_data(data_source)
        # 结果检查
        return self.dh.check_result(data_source)