5
5
import requests
6
6
import time
7
7
8
-
9
8
def get_code (mobile ):
9
+ """
10
+ 获取验证码
11
+ :param mobile:手机号
12
+ :return:拼接后的手机号,验证码id
13
+ """
10
14
url = "https://e.xinrenxinshi.com/site/ajax-send-sms-code/login"
11
15
mobile = "+86-" + str (mobile )
12
16
data = {
@@ -19,6 +23,13 @@ def get_code(mobile):
19
23
20
24
21
25
def login (mobile , coid_id , code ):
26
+ """
27
+ 登录
28
+ :param mobile: 手机号
29
+ :param coid_id: 验证码Id
30
+ :param code: 验证码
31
+ :return:cookies
32
+ """
22
33
url = "https://e.xinrenxinshi.com/site/ajax-login"
23
34
data = {
24
35
"mobile" : mobile ,
@@ -28,11 +39,18 @@ def login(mobile, coid_id, code):
28
39
"type" : "1"
29
40
30
41
}
31
- response = requests .post (url = url , data = data )
32
- print (response .text )
42
+ response = requests .post (url = url , data = data ).json ()
43
+ print (response )
44
+ print (response .cookies .get_dict ())
33
45
46
+ cookies = response .cookies .get_dict ()
47
+ return cookies
34
48
35
49
def get_x_y ():
50
+ """
51
+ 获取坐标 暂时不明白参数是什么 需要修改
52
+ :return:
53
+ """
36
54
url = "https://api.map.baidu.com/location/ip?qt=loc&coor=bd09ll&ak=Er8iGG4UMfSd3Ckuc6w8C56peI4ge1Ih&timeout=10000&callback=_cbk54880"
37
55
response = requests .get (url ).text
38
56
@@ -43,10 +61,15 @@ def get_x_y():
43
61
return x , y
44
62
45
63
46
- def get_csrf_token ():
64
+ def get_csrf_token (cookies ):
65
+ """
66
+ 根据cookies获取csrf
67
+ :param cookies:cookies
68
+ :return: csrf
69
+ """
47
70
url = "https://e.xinrenxinshi.com/env/ajax-common?timestamp=1588144329000&app_key=employee&sign_method=md5&version=1.0.0&sign=93740301c08661e7503dab361d7cd8f8"
48
71
headers = {
49
- "cookie" : "QJYDSID=0b32ba0a549e41d7b6f1e57c9a851ab1_247cf3ae48d4464597a0dd764b60c755"
72
+ "cookie" : cookies
50
73
}
51
74
response = requests .get (url , headers = headers ).json ()
52
75
print (response )
@@ -56,8 +79,17 @@ def get_csrf_token():
56
79
57
80
58
81
def card (x , y ):
82
+ """
83
+ 根据经纬度坐标打卡
84
+ :param x:
85
+ :param y:
86
+ :return:
87
+ """
59
88
url = "https://e.xinrenxinshi.com/attendance/ajax-sign"
60
89
timestamp = str (int (time .time () * 100 ))
90
+ headers = {
91
+
92
+ }
61
93
data = {
62
94
"accuracy" : "150" ,
63
95
"latitude" : x ,
@@ -69,19 +101,18 @@ def card(x, y):
69
101
response = requests .post (url = url , data = data )
70
102
print (response .text )
71
103
72
-
73
104
if __name__ == '__main__' :
74
105
mobile = 15735656005
75
106
# x,y =get_x_y()
76
- x , y = 40.0647820300 , 116.1822295900
77
- print (x , y )
78
- s = get_csrf_token ()
79
- print (s )
107
+ # x, y = 40.0647820300,116.1822295900
108
+ # print(x,y)
109
+ # s = get_csrf_token()
110
+ # print(s)
80
111
# res = card(x,y)
81
112
# print(res)
82
- # mobile,code_id = get_code(mobile)
83
- # code = input("请输入验证码")
84
- # response = login(mobile,code_id,code)
113
+ mobile , code_id = get_code (mobile )
114
+ code = input ("请输入验证码" )
115
+ response = login (mobile , code_id , code )
85
116
# print(response)
86
117
# mobile:
87
118
#
0 commit comments