工学云一键每天自动异地打卡最新超简单教程

2023-12-22 20:26:20 浏览数 (2)

工学云打卡助手,能解决你在异地时每天不间断签到的问题。

通过python代码实现以下功能:

1.自动签到

2.自定义打卡地区

3.生成日周月报与总结自动发表

4.支持随机通用内容

5.支持打卡结果推送

首先展示成品:工学云自动打卡图文教程.docx - 蓝奏云,不会编程的同学可以直接调用。

工学云自动打卡图文教程.rar

接下来是功能代码:

1.登录界面

代码语言:python代码运行次数:12复制
def login():
    url = "https://api.moguding.net:9000/session/user/v1/login"
    headers = {
        "Content-Type": "application/json; charset=UTF-8",
        "User-Agent": "Mozilla/5.0 (Linux; U; Android 10; zh-cn; ELS-AN00 Build/HUAWEIELS-AN00) AppleWebKit/533.1 (KHTML, like Gecko) Version/5.0 Mobile Safari/533.1",
    }
    data = {
        "phone": "你的账号", 
        "password": "你的密码", 
        "loginType": "android"
        }
    res = requests.post(url,headers=headers,data=json.dumps(data)).json()
    if res['code'] != 200 :
        print("登录失败,错误信息为" res['msg'])
    else:
        Login_info['token'] = res['data']['token']
        Login_info['userId'] = res['data']['userId']
        Login_info['moguNo'] = res['data']['moguNo']

2.进行上下班打卡

代码语言:python代码运行次数:4复制
# 根据现在时间判断上下班签到
# 上班  8-16
def get_time():
    mytime = time.localtime()
    if mytime.tm_hour < 8 or mytime.tm_hour > 16:
        Login_info['cardType'] = 'END'  # 上班
    else:
        Login_info['cardType'] = 'START'    # 下班

3.将打卡结果邮件通知

代码语言:python代码运行次数:1复制
# 发送邮件
def send_email(text):
    mail_host = "smtp邮件服务器地址"  
    mail_user = "smtp邮件服务器账号" 
    mail_pass = "smtp邮件服务器授权码"
    sender = mail_user	# 发件人邮箱地址
    receivers = ['收件人邮箱地址']
    content = text
    title = '工学云每日签到信息'
    message = MIMEText(content, 'plain', 'utf-8')
    message['From'] = "{}".format(sender)
    message['To'] = ",".join(receivers)
    message['Subject'] = title
    try:
        smtpObj = smtplib.SMTP_SSL(mail_host, 465)
        smtpObj.login(mail_user, mail_pass)
        smtpObj.sendmail(sender, receivers, message.as_string())
    except smtplib.SMTPException as e:
        print(e)

以上就是基本功能的python代码了,有能力的同学可以试试看,或者直接调用作者的成品。

0 人点赞