[Python] 纯文本查看 复制代码 import requests
import json
def send(token, planId):
# address 自己填一下就可以了 longitude 经度 latitude纬度 在地图上搜一下
data = {"country": "中国", "address": "河北省 · 石家庄市 · 石家庄水电机动车驾驶员学校", "province": "河北省", "city": "石家庄市",
"latitude": "38.038716", "description": "", "planId": planId, "type": "END",
"device": "Android", "longitude": "114.411354"}
data = json.dumps(data)
url = 'https://api.moguding.net:9000/attendence/clock/v1/save'
headers = {
'Authorization': token,
'Content-Type': 'application/json; charset=UTF-8'
}
res = requests.post(url=url, data=data, headers=headers).text
print(res)
def getplanId(token):
data = {
'paramsType': "student"
}
data = json.dumps(data)
headers = {
'Authorization': token,
}
url = "https://api.moguding.net:9000/practice/plan/v1/getPlanByStu"
res = requests.post(url=url, data=data, headers=headers).text
res = json.loads(res)
planId = res['data'][0]['planId']
send(token, planId)
def login():
data = {
'phone': '157321',
'password': 'a123456',
'loginType': 'android'
}
res = requests.post('https://api.moguding.net:9000/session/user/v1/login',
data=json.dumps(data),
headers={
'Content-Type': 'application/json; charset=UTF-8'
}, ).text
res = json.loads(res)
if (res['code'] != 200):
print("请检查账号")
exit()
token = res['data']['token']
getplanId(token)
login() |