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)
def login_sp(self, data): data['password'] = Base.make_password(data['password']) Log.info('login data is %s' % data) Log.info('login url is %s' % self.url) res = requests.post(url=self.url, data=json.dumps(data), headers=self.headers) return res
def get_req_para(cls, para_id, data_id): req_para = Base.get_req_para(para_id, data_id) req_para['password'] = Base.make_password(req_para['password']) return req_para