Git Product home page Git Product logo

seu_daily_report's Introduction

1. 东南大学 疫情每日上报及入校申请自动化脚本

项目fork自https://github.com/wangyz1997/seu_daily_report

免责声明:本脚本仅为个人为学习python之目的所编写,使用该脚本造成的一切后果均由使用者承担。

本人仍然提倡每日按时手动进行疫情上报与入校申请,配合学校进行好疫情防控。

2. 使用方法:

2.1. 下载WebDriver

2.1.1. Chrome

首先请检查您安装的Chrome版本:浏览器右上角的3个点-帮助-关于Google Chrome。

接下来,进入 淘宝Chrome Driver镜像站 下载与您使用浏览器相同版本的Chrome Driver。

下载后请与本脚本文件放置于同一目录中, Windows平台命名为Chromedriver.exe

Linux/macOS平台请将可执行文件放置于与脚本相同的目录中,并自行修改脚本中executable_path中的文件名。

2.1.2. FireFox

由于本人使用Ubuntu20.04 Server(32bit),使用Firefox作为执行脚本的浏览器

浏览器安装: sudo apt-get install firefox

Firefox的webdriver为geckodriver,release版本网址https://github.com/mozilla/geckodriver/releases,下载对应版本后按网上教程的说法是放入/usr/local/bin后即可,但是本人没有成功。

本人最后是通过apt安装: sudo apt-get install firefox-geckodriver

对于Firefox,在获取webdriver时应调用selenium.webdriver.Firefox()

2.2. 下载python依赖

本脚本依赖selenium包与requests包。要安装它们,只需要使用pip即可。

# Windows
pip install requests selenium -i https://pypi.douban.com/simple --user
# unix-python3
pip3 install requests selenium -i https://pypi.douban.com/simple --user

2.3. 使用 server酱 接收脚本执行结果

server酱 是一个微信推送工具,可以将服务器端执行结果推送到您的微信上。

本脚本支持 server酱 推送,您只需要按照其网站上的指引,使用GitHub账号登录并扫码绑定您的微信,即可获得SCKEY。 将取得的SCKEY填入config.json中的server_chan_key字段中,即可启用微信推送功能。

提示:将server_chan_key留空,即可禁用微信推送功能。

2.4. 配置脚本

提示:与1.0版本中不同,2.0中为了实现多用户功能,改用了json格式的配置文件,如果您进行了版本升级,请重新进行配置。

将脚本目录中的config_sample.json重命名为config.json

打开config.json,向其中的usernamepassword后填入您的一卡通账号与密码。

您还可以在其中的temp_range中自定义您想要填写的体温范围。 请一定要在确定自己体温正常的情况下使用此功能。

placesreasons中您还可以自定义您每日想要填写的入校区域与入校理由,其中的第一个元素为周一,最后一个元素为周日。

reasons的取值0-7所对应的理由如下所示。

理由 对应数字
到教学楼上课 0
实验室做实验 1
到办公室科研 2
到图书馆学习借书 3
到职能部门、院系办手续 4
开会 5
往返无线谷实验室 6
其他 7

除此之外,在config.json中的config字段中,您也可以通过将enable_enter_campus_apply项设置为true来启动入校申请或false来关闭入校申请。

2.5. 运行脚本

在您正式运行脚本之前,请确认您脚本目录下的文件和下面相同:

|-- seu_daily_report
    |-- .gitignore
    |-- chromedriver.exe
    |-- config.json
    |-- main.py
    |-- README.md

之后,使用python运行main.py即可。 您也可以将脚本与运行环境部署到云服务器上,并设置定时计划任务,实现每日自动签到。

2.6. 进阶

若想要同时为多个用户执行本脚本,只需要将config.jsonusers字段的配置信息复制多份,每一份均填写一位用户的信息即可。

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.