def enterprise_login(): login_password('13252477137', '990eb670f81e82f546cfaaae1587279a') url = 'https://passport.lagou.com/ajaxLogin/frameGrant.html?fl=2&service=https%3A%2F%2Fkaiwu.lagou.com%2Fenterprise%2Findex.html%23%2Findex&osc=PASSPORT._pscb(1)&ofc=PASSPORT._pfcb(1)&pfurl=https%3A%2F%2Fkaiwu.lagou.com%2Fenterprise%2Findex.html%23%2Findex' get_requests( url, headers={'referer': 'https://kaiwu.lagou.com/enterprise/index.html'}) search_referer_url = 'https://kaiwu.lagou.com/enterprise/index.html' get_requests(search_referer_url)
def dake_no_class(): login_password(username='******', password="******") # 重定向跳转到kaiwu.lagou.com的处理 get_requests( url= 'https://kaiwu.lagou.com/?action=grantST&ticket=ST-6c0d87f702634bf7bf2fa14b82b72b02&fl=2&osc=PASSPORT._pscb%282%29&ofc=PASSPORT._pfcb%282%29&pfurl=https%3A%2F%2Fkaiwu.lagou.com%2F' )
def regular_batch_cancel_account(): result = read_cancel_account() if not bool(result): logger.info(f'无需注销的数据\n') return logger.info(f'开始注销用户id:{",".join(result)}\n') r = login_password('*****@*****.**', '00f453dfec0f2806db5cfabe3ea94a35') assert_equal(1, r.get('state'), '校验登录home成功!', te='foxtang') fail_user_ids = '' success_user_ids = '' for user_id in result: time.sleep(1) forbid_result = verify_user_is_forbid(user_id) if forbid_result == False: forbid_result = forbid_user(user_id) if forbid_result == False: fail_user_ids += f'{user_id},' record_cancel_account(user_id) else: success_user_ids += f'{user_id},' r = batchCancel(userIds=user_id) if r.get('state') != 1: fail_user_ids += f'{user_id},' else: success_user_ids += f'{user_id},' rewrite_cancel_account() if success_user_ids != '': result = list(set(success_user_ids.split(','))) send_cancel_result(message='注销封禁用户Id成功', result=result) if fail_user_ids != '': record_cancel_account(fail_user_ids)
def my_login_password(request): login_password(request.param[0], request.param[1]) # #获取收藏人才的cueserid和resumeFetchKey # @pytest.fixture() # def get_collection_info(): # res = rec_talent() # cueserid = res.get('data').get('page').get('resuit')[0].get('userId') # resumeFetchKey = res.get('data').get('page').get('resuit')[0].get('resumeFetchKey') # return cueserid,resumeFetchKey # # #获取取消收藏人才的collectionIds # def get_uncollection_id(): # res = talent_collection_list() # collectionIds = res.get('data').get('page').get('resuit')[0].get('id') # return collectionIds
def query_company_id(name): url = 'http://home.lagou.com/forbid/companyController/queryCompanys.json' header = get_header(url='http://home.lagou.com/') data = {'searchContent': f"{name}", 'limit': 30, 'currentPage': 0, 'type': 2, 'limitEnd': 30} result = form_post(url=url, headers=header, data=data, remark='查询用户id', rd='royliu') try: if result['success'] == True and (len(result['data']['pageData']) > 0): return result['data']['pageData'][0]['id'] except: return False if __name__ == '__main__': login_password(username='******', password='******') # ids = [15576859, 15576821, 15576816, 15576806, 15576799, 15587425, 15576660, 15576652, 15576430, 15576423, 15576405] # ids = [15568389, 15568375, 15568364, 15568304, 15568256, 15568233, 15568220, 15241840, 15309651, 15545942, # 15431115, 15470085, 15222746, 15231268, 15232802] ids = [15232864, 15470242, 15470246, 15470379, 15594841, 15592474, 15577156, 15577149, 15577090, 15577085, 15576954, 15576950, 15576937, 15576763] # ids = [15576757, 15576695, 15576688, 15576666, 15568195, 15568178, 15568153, 15568130, 15567700, 15567691, 15567400, # 15567390, 15562495, 15562483, 15558634] # ids = [15558629, 15554148, 15554140, 15553909, 15553655, 15252648, 15255408, 15232933, 15233096, 15233116, # 15255474, 15255485, 15429912] # for id in ids: # forbid_user(id) print(type(verify_user_is_forbid(15754261))) print('用户封禁结果是{}'.format(verify_user_is_forbid(15754261))) print('公司封禁结果是{}'.format(verify_company_is_forbid(117437231)))
def b_login_web(request): r = login_password(request.param[0], request.param[1]) return r.get('state', 0)
# coding:utf-8 # @Time : 2019-11-29 11:42 # @Author: Xiawang # Description: import json from utils.util import get_code_token, json_put, login_password, get_header, get_requests def upate_user_password(newPassword): code, token = get_submit_token_code() url = 'https://gate.lagou.com/v1/neirong/account/users/0/password' header = {'X-Anit-Forge-Code': code, 'X-Anit-Forge-Token': token, 'X-L-REQ-HEADER': json.dumps({'deviceType': 1})} data = {'newPassword': newPassword, 'newPassword2': newPassword} return json_put(url=url, data=data, headers=header, remark='PC端修改密码', rd='曾小宁') def get_submit_token_code(): url = 'https://gate.lagou.com/v1/neirong/account/users/0/' header = {'X-L-REQ-HEADER': json.dumps({'deviceType': 1}), 'Referer': 'https://account.lagou.com/v2/account/modifyPwd.html', 'Sec-Fetch-Mode': 'cors'} r = get_requests(url=url, headers=header, remark="获取token、code", rd='曾小宁') return r['submitCode'], r['submitToken'] if __name__ == '__main__': login_password('0085220131723', "990eb670f81e82f546cfaaae1587279a") upate_user_password()
def test_login_home(self): # 线上home后台的用户账号和密码, 勿动 r = login_password('*****@*****.**', 'a52f33ba89bd7af92982da737cafc8d0') assert_equal(1, r['state'], '校验登录home成功!', te='foxtang')
url = 'https://home.lagou.com/crm/excelImportController/contact.json' header = get_header(url=referer_url) project_path = os.path.dirname(os.path.dirname(os.path.dirname(__file__))) if not 'JSESSIONID' in header['Cookie']: header['Cookie'] = header['Cookie'] + ' JSESSIONID' + read_jsessionid( project_path) + ';' + ' login=true' project_path = os.path.dirname(os.path.dirname(os.path.dirname(__file__))) file_Path = '{}/tests/testdata/import2.xls'.format(project_path) update_excel(file_Path, companyId, contractNo) files = {'file': open(file_Path, 'rb')} remark = 'home后台-拉勾加-数据导入-导入合同信息' return form_post(url=url, files=files, headers=header, remark=remark, rd='李久超') if __name__ == '__main__': login_password('*****@*****.**', 'a52f33ba89bd7af92982da737cafc8d0') r = import_linkManInfo(117448258, 'lg-auto-test-20191219-12') # import_contacts(117448258, 'lg-auto-test-20191219-11') print(type(r)) print(r) # project_path = os.path.dirname(os.path.dirname(os.path.dirname(__file__))) # os.chdir(project_path) # print(project_path) # record_jsessionid(project_path, 'hifewhkrhweakjrhaew84823423') # print(read_jsessionid(project_path))
def test_login_admin_user_03(self, get_password): login_result = login_password(admin_countryCode + admin_phone, get_password) assert_equal(1, login_result['state'], '校验管理员登录是否成功', te='王洋')
def test_login_admin_user_02(self, get_password): login_result = login_password(admin_countryCode + admin_phone, get_password) assert_equal(1, login_result.get('state', 0), '校验管理员登录是否成功', te='王洋') www_redirect_easy()
# coding:utf-8 # @Time : 2020/4/27 14:44 # @Author: Xiawang # Description: import json from utils.util import get_requests, login_password, get_header def get_rights_info_list(): url = 'https://gate.lagou.com/v1/zhaopin/rights/getRightsInfoList' header = get_header(url='https://easy.lagou.com/userGoodsRecord/queryGoods/index.htm?') header.update({'Referer': 'https://easy.lagou.com/userGoodsRecord/queryGoods/index.htm?', 'X-L-REQ-HEADER': json.dumps({'deviceType': 1})}) remark = '获取基础权益' return get_requests(url=url, headers=header, remark=remark) if __name__ == '__main__': login_password('0085220200427', 'c47eeb69fa4e64971fb29cb1e9163a19') # jump_easy_index_html() r = get_rights_info_list() print(r)
def is_show_position_notice(ip_port=None): url = 'https://easy.lagou.com/position/multiChannel/isShowPositionNotice.json' header = get_header( url='https://easy.lagou.com/settings/new/channel/my_channels.htm?', ip_port=ip_port) remark = '是否显示职位通知' return form_post(url=url, headers=header, remark=remark, ip_port=ip_port) def dashboard_index_get_user_id(): url = 'https://easy.lagou.com/dashboard/index.htm?from=c_index' r = get_requests(url=url) soup = BeautifulSoup(r, "html.parser") try: userId = soup.find(id="UserId")['value'] UserCompanyId = soup.find(id="UserCompanyId")['value'] except TypeError: r = get_requests(url=url, remark='获取easy主页的用户id') soup = BeautifulSoup(r, "html.parser") userId = soup.find(id="UserId")['value'] UserCompanyId = soup.find(id="UserCompanyId")['value'] lagou_company_id = re.findall(r'lgId: "(.*?)"', r)[0] return userId, UserCompanyId, lagou_company_id if __name__ == '__main__': login_password('13033647506', '9062e77da243687c68bf9665727b5c01') print(dashboard_index_get_user_id())
def login_0012020010425(request): login_password(request.param[0], request.param[1])