[Python] 纯文本查看 复制代码
import requests
import json
from tkinter import *
from requests.packages.urllib3.exceptions import InsecureRequestWarning
requests.packages.urllib3.disable_warnings(InsecureRequestWarning)#去掉ssl烦人的警告
def log():
phone=input("账号:")
password=input("密码:")
headers = {
"Accept-Language": "zh-CN,zh;q=0.8",
"User-Agent": "Mozilla/5.0 (Linux; U; Android 8.0.0; zh-cn; MI 6 Build/OPR1.170623.027) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30",
"Authorization": "",
"roleKey": "",
"Content-Type": "application/json; charset=UTF-8",
"Content-Length": "85",
"Host": "api.moguding.net:9000",
"Connection": "close",
"Accept-Encoding": "gzip, deflate",
"Cache-Control": "no-cache",
}
url="https://api.moguding.net:9000/session/user/v1/login"
pyload={"password":password,"phone":phone,"loginType":"android","uuid":""}
response = requests.post(url,data=json.dumps(pyload),headers=headers,verify=False).text
response = json.loads(response)
Authorization = response["data"]["token"]
print(Authorization)
return Authorization #这个就相当你开门的钥匙
def planId(Authorization):
headers = {
"Accept-Language": "zh-CN,zh;q=0.8",
"User-Agent": "Mozilla/5.0 (Linux; U; Android 8.0.0; zh-cn; MI 6 Build/OPR1.170623.027) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30",
"Authorization":Authorization, #发送数据给蘑菇钉需要登陆时候给你的钥匙
"roleKey": "student",
"Content-Type": "application/json; charset=UTF-8",
"Content-Length": "500",
"Host": "api.moguding.net:9000",
"Connection": "close",
"Accept-Encoding": "gzip, deflate",
"Cache-Control": "no-cache",
}
url = "https://api.moguding.net:9000/practice/plan/v1/getPlanByStu"
data={"state":""}
response = requests.post(url,data=json.dumps(data),headers=headers,verify=False).text
response = json.loads(response)
return response['data'][0]['planId']
def sin(Authorization,planId):
country=input("你想在的国家:")
address=input("你想在的地址:")
province=input("你想在的地址:")
city=input("你想在的城市:")
type=input("上班填START下班填END:")
description=input("发表的内容:")
url2="https://api.moguding.net:9000/attendence/clock/v1/save"
headers2 = {
"Accept-Language": "zh-CN,zh;q=0.8",
"User-Agent": "Mozilla/5.0 (Linux; U; Android 8.0.0; zh-cn; MI 6 Build/OPR1.170623.027) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30",
"Authorization":Authorization, #发送数据给蘑菇钉需要登陆时候给你的钥匙
"roleKey": "student",
"Content-Type": "application/json; charset=UTF-8",
"Content-Length": "500",
"Host": "api.moguding.net:9000",
"Connection": "close",
"Accept-Encoding": "gzip, deflate",
"Cache-Control": "no-cache",
}
#下面改改就能达到你想在什么地方就在什么地方,经纬度蘑菇钉会根据地理位置识别
data={"country":country, #国家
"address":address, #地址
"province":"伊拉克", #省
"city":"伊拉克", #城市
"latitude":"24.341287" ,#纬度
"description":description,#发表的信息
"planId":planId,
"type":type, #START 上班 END 下班
"device":"Android",
"longitude":"109.42808"#经度
}
response2 = requests.post(url2,data=json.dumps(data),headers=headers2,verify=False).text
response2 = json.loads(response2)
print(response2)
if __name__=='__main__':
Authorization=log()
planId=planId(Authorization)
sin(Authorization,planId)