资源简介
原创,基于Python的四川大学微服务定时自动签到脚本,仅供学习使用,切勿用于商业途径,任何因此造成的损失与本人无关;代码健壮性一般,核心技术CSS选择,正则表达式,HTTP请求模拟;
代码片段和文件信息
import smtplib
import schedule
import requests
from fake_useragent import UserAgent
import re
import json
from email.mime.text import MIMEText
from email.header import Header
import time
# -------------------------------------全局变量--------------------------------------------------------------------------
# 会话保持
session = requests.Session()
# 邮件配置区
mail_user = “1xxxxxxx@qq.com“ # 用户名
mail_pass = “xxxxxxx“ # 口令 在QQ邮箱设置里面
sender = ‘xxxxxx@qq.com‘ # 发送者
# 接收邮件,可设置为你的QQ邮箱或者其他邮箱
# ------------------------------------------------我想骚一点不好意思---------------------------------------------------
class colors:
PINK = ‘\033[95m‘
BLUE = ‘\033[94m‘
GREEN = ‘\033[92m‘
YELLOW = ‘\033[93m‘
RED = ‘\033[91m‘
END = ‘\033[0m‘
# -----------------------------------登录界面获取cookie------------------------------------------
def data_get(uspa):
url = ‘https://wfw.scu.edu.cn/a_scu/api/sso/check‘
url_for_id = ‘https://wfw.scu.edu.cn/ncov/wap/default/index‘
data = {
‘username‘: us
‘password‘: pa
‘redirect‘: ‘https://wfw.scu.edu.cn/ncov/wap/default/index‘
}
header = {
‘Referer‘: ‘https://wfw.scu.edu.cn/site/polymerization/polymerizationLogin?redirect=https%3A%2F%2Fwfw.scu.edu‘
‘.cn%2Fncov%2Fwap%2Fdefault%2Findex&from=wap‘
‘User-Agent‘: UserAgent().chrome
‘Host‘: ‘wfw.scu.edu.cn‘
‘Origin‘: ‘https://wfw.scu.edu.cn‘
}
r = session.post(url data=data headers=header timeout=3).json()
if r[‘m‘] == ‘操作成功‘:
r2 = session.get(url_for_id headers=header).text
x = re.findall(r‘.*?oldInfo: (.*).*?‘ r2)
data = eval(x[0])
return data
# ---------------------------------------填报界面------------------------------------------
def post(uspa) -> json:
headers = {
‘Host‘: ‘wfw.scu.edu.cn‘
‘User-Agent‘: UserAgent().chrome
‘Accept‘: ‘application/jsontext/javascript*/*;q=0.01‘
‘Accept-Language‘: ‘zh-CNzh;q=0
相关资源
- pywin32_python3.6_64位
- python+ selenium教程
- PycURL(Windows7/Win32)Python2.7安装包 P
- 英文原版-Scientific Computing with Python
- 7.图像风格迁移 基于深度学习 pyt
- 基于Python的学生管理系统
- A Byte of Python(简明Python教程)(第
- Python实例174946
- Python 人脸识别
- Python 人事管理系统
- 基于python-flask的个人博客系统
- 计算机视觉应用开发流程
- python 调用sftp断点续传文件
- python socket游戏
- 基于Python爬虫爬取天气预报信息
- python函数编程和讲解
- Python开发的个人博客
- 基于python的三层神经网络模型搭建
- python实现自动操作windows应用
- python人脸识别(opencv)
- python 绘图(方形、线条、圆形)
- python疫情卡UN管控
- python 连连看小游戏源码
- 基于PyQt5的视频播放器设计
- 一个简单的python爬虫
- csv文件行列转换python实现代码
- Python操作Mysql教程手册
- Python Machine Learning Case Studies
- python获取硬件信息
- 量化交易(附python常见函数的使用方
评论
共有 条评论