Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 9204ffa

Browse files
committed
薪人薪事打卡
1 parent f42b719 commit 9204ffa

File tree

1 file changed

+44
-13
lines changed

1 file changed

+44
-13
lines changed

薪人薪事打卡/card.py

Lines changed: 44 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,12 @@
55
import requests
66
import time
77

8-
98
def get_code(mobile):
9+
"""
10+
获取验证码
11+
:param mobile:手机号
12+
:return:拼接后的手机号,验证码id
13+
"""
1014
url = "https://e.xinrenxinshi.com/site/ajax-send-sms-code/login"
1115
mobile = "+86-" + str(mobile)
1216
data = {
@@ -19,6 +23,13 @@ def get_code(mobile):
1923

2024

2125
def login(mobile, coid_id, code):
26+
"""
27+
登录
28+
:param mobile: 手机号
29+
:param coid_id: 验证码Id
30+
:param code: 验证码
31+
:return:cookies
32+
"""
2233
url = "https://e.xinrenxinshi.com/site/ajax-login"
2334
data = {
2435
"mobile": mobile,
@@ -28,11 +39,18 @@ def login(mobile, coid_id, code):
2839
"type": "1"
2940

3041
}
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())
3345

46+
cookies = response.cookies.get_dict()
47+
return cookies
3448

3549
def get_x_y():
50+
"""
51+
获取坐标 暂时不明白参数是什么 需要修改
52+
:return:
53+
"""
3654
url = "https://api.map.baidu.com/location/ip?qt=loc&coor=bd09ll&ak=Er8iGG4UMfSd3Ckuc6w8C56peI4ge1Ih&timeout=10000&callback=_cbk54880"
3755
response = requests.get(url).text
3856

@@ -43,10 +61,15 @@ def get_x_y():
4361
return x, y
4462

4563

46-
def get_csrf_token():
64+
def get_csrf_token(cookies):
65+
"""
66+
根据cookies获取csrf
67+
:param cookies:cookies
68+
:return: csrf
69+
"""
4770
url = "https://e.xinrenxinshi.com/env/ajax-common?timestamp=1588144329000&app_key=employee&sign_method=md5&version=1.0.0&sign=93740301c08661e7503dab361d7cd8f8"
4871
headers = {
49-
"cookie": "QJYDSID=0b32ba0a549e41d7b6f1e57c9a851ab1_247cf3ae48d4464597a0dd764b60c755"
72+
"cookie": cookies
5073
}
5174
response = requests.get(url, headers=headers).json()
5275
print(response)
@@ -56,8 +79,17 @@ def get_csrf_token():
5679

5780

5881
def card(x, y):
82+
"""
83+
根据经纬度坐标打卡
84+
:param x:
85+
:param y:
86+
:return:
87+
"""
5988
url = "https://e.xinrenxinshi.com/attendance/ajax-sign"
6089
timestamp = str(int(time.time() * 100))
90+
headers = {
91+
92+
}
6193
data = {
6294
"accuracy": "150",
6395
"latitude": x,
@@ -69,19 +101,18 @@ def card(x, y):
69101
response = requests.post(url=url, data=data)
70102
print(response.text)
71103

72-
73104
if __name__ == '__main__':
74105
mobile = 15735656005
75106
# 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)
80111
# res = card(x,y)
81112
# 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)
85116
# print(response)
86117
# mobile:
87118
#

0 commit comments

Comments
 (0)