可以把这个程序放在服务器上,设置一个计划任务就完成了蘑菇钉的自动签到,原作者有封装好的exe程序可以直接在64位电脑运行,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 9.0.0; zh-cn; MI 6X 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 9.0.0; zh-cn; MI 6X 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):
    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 9.0.0; zh-cn; MI 6X 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",
        }
    #下面改改就能达到你想在什么地方就在什么地方,经纬度蘑菇钉会根据地理位置识别a
    data={"country":"中国",     #国家
             "address":"重庆市 · ******",  #地址
             "province":"重庆", #省
             "city":"渝北",     #城市
             "latitude":"39.751123" ,#纬度
             "description":description,#发表的信息
             "planId":planId,
             "type":"START",  #START  上班  END 下班
             "device":"Android",
             "longitude":"116.562875"#经度
             }
    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)

转载说明:
作者:一身白
链接:https://www.52pojie.cn/thread-1068806-1-1.html