File tree Expand file tree Collapse file tree 1 file changed +62
-0
lines changed Expand file tree Collapse file tree 1 file changed +62
-0
lines changed Original file line number Diff line number Diff line change 1+ import requests
2+ #!/usr/bin/ python3
3+ # -*- coding: utf-8 -*-
4+ import requests
5+
6+ """
7+ info:
8+ author:CriseLYJ
9+ github:https://github.com/CriseLYJ/
10+ update_time:2019-04-06
11+ """
12+
13+ """
14+ 模拟登陆招聘狗
15+ """
16+
17+ class ZhaoPinGouLogin (object ):
18+
19+ def __init__ (self , account , password ):
20+ self .url = "https://qiye.zhaopingou.com/zhaopingou_interface/security_login?timestamp=1554552162122"
21+ self .headers = {
22+ "User-Agent" : "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.103 Safari/537.36" ,
23+ "Refer" : "https://qiye.zhaopingou.com/signin?callback=https%3A%2F%2Fqiye.zhaopingou.com%2Fresume" ,
24+ "Host" : "qiye.zhaopingou.com"
25+ }
26+ self .data = {
27+ 'userName' : account ,
28+ 'password' : password ,
29+ 'code' : '' ,
30+ 'clientNo' : '' ,
31+ 'userToken' : '' ,
32+ 'clientType' : '2'
33+ }
34+ self .session = requests .Session ()
35+
36+ def get_coolie (self ):
37+ """模拟登陆获取cookie"""
38+ resp = self .session .post (
39+ url = self .url ,
40+ headers = self .headers ,
41+ data = self .data
42+ )
43+ resp_dict = resp .json ()
44+
45+ if resp_dict ["errorCode" ] == 1 :
46+ print ("登陆成功" )
47+ # 获取登陆过的cookies
48+ cookies = resp .cookies
49+ print (cookies )
50+ return cookies
51+ else :
52+ print ("登陆失败" )
53+
54+ def run (self ):
55+ self .get_coolie ()
56+
57+
58+ if __name__ == '__main__' :
59+ account = input ("请输入你的账号:" )
60+ password = input ("请输入你的密码:" )
61+ spider = ZhaoPinGouLogin (account , password )
62+ spider .run ()
You can’t perform that action at this time.
0 commit comments