-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathclock_ecnu.py
More file actions
27 lines (26 loc) · 901 Bytes
/
clock_ecnu.py
File metadata and controls
27 lines (26 loc) · 901 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import time
import requests
import json
import datetime
import os
if __name__ == '__main__':
host = "https://anti-epidemic.ecnu.edu.cn/"
str_ids = os.environ["ECNUID"]
ids = str_ids.split(",")
for id in ids:
s = requests.Session()
r = s.get(host + "/clock/user/v2/{}".format(id))
print(r.json())
data = {
"number": id,
"location": "在学校",
"health": "健康,未超过37.3",
"recordTime": int(time.time() * 1000),
"token": "c40a1c26761cf1aa147006efdbced498"
}
headers = {'Content-Type': 'application/json'}
r = s.put(host + "/clock/record", json.dumps(data), headers=headers)
print(r.json())
now = datetime.date.today()
r = s.get(host + "/clock/record/{}?date={}%2F{}%2F{}".format(id,now.year, now.month, now.day))
print(r.json())