Compare commits

...

10 Commits

Author SHA1 Message Date
Les1ie
1c811caaeb Update README.md
Some checks failed
CI / build (push) Has been cancelled
2020-04-08 15:17:50 +08:00
Les1ie
b00f40e912 Merge pull request #1 from karuboniru/master
Add GitHub Actions support
2020-04-08 14:41:55 +08:00
Qiyu Yan
c35b05a7b2 fix doc 2020-04-08 13:51:41 +08:00
Qiyu Yan
93a2a2334e finish github action support 2020-04-08 13:48:42 +08:00
Qiyu Yan
9b4a734bde add token to sub.py 2020-04-08 13:41:25 +08:00
Karuboniru
49ddc56bd7 Update report.yml 2020-04-08 13:40:17 +08:00
Karuboniru
585d42ff8b fixing 2020-04-08 13:37:32 +08:00
Karuboniru
3ac306793b Create report.yml 2020-04-08 13:35:08 +08:00
Qiyu Yan
30a770aebd github actions token for sub.py 2020-04-08 13:34:13 +08:00
Qiyu Yan
9505b1c358 add action token 2020-04-08 13:23:20 +08:00
4 changed files with 54 additions and 7 deletions

36
.github/workflows/report.yml vendored Normal file
View File

@@ -0,0 +1,36 @@
# This is a basic workflow to help you get started with Actions
name: CI
# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the master branch
on:
schedule:
- cron: '0 0 * * *'
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
- name: Set up Python 3.6
uses: actions/setup-python@v1
with:
python-version: 3.6
# Runs a set of commands using the runners shell
- name: Run a multi-line script
run: |
python -m pip install --upgrade pip
python -m pip install pytz requests datetime
sed -i "s/PASSWORD/${{ secrets.SEP_PASSWD }}/g" sub.py
sed -i "s/USERNAME/${{ secrets.SEP_USER_NAME }}/g" sub.py
sed -i "s/API_KEY/${{ secrets.API_KEY }}/g" sub.py
python ./sub.py >> /dev/null

View File

@@ -1,7 +1,7 @@
# ucas-covid19
国科大疫情防控每日填报助手,用于解决忘记填写企业微信中身体状况每日打卡的问题。
本人不对因为滥用此程序造成的后果负责,**请在合理且合法的范围内使用本程序**。
本人不对因为滥用此程序造成的后果负责,**请在合理且合法的范围内使用本程序**。
**本程序仅用于解决忘记打卡这一问题,如果身体状况发生变化或者地点发生变化,请务必在程序运行之前手动打卡。**
@@ -37,14 +37,25 @@ ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
5. 点击完成
6. 点击触发方式选择添加触发方式输入定时任务名称daily触发周期为自定义触发周期 cron表达式 `0 30 8 * * * *`,点击完成
使用腾讯云的云函数打卡的计算量和调用量极低,不会收费。
# 使用 GitHub Actions
如果你不喜欢腾讯云, 就可以使用 GitHub Action 来进行运行, 使用步骤:
- 克隆这个仓库到你名下
- fork的仓库默认禁用了`workflow`,需要手动打开:点击 `actions`选项卡,点击`I understand my workflows, go ahead rand run them`
- 在仓库设置里面, 设置 secrets 如下
- `SEP_USER_NAME`: 你的 SEP 用户名(邮箱)
- `SEP_PASSWD`: 你的 SEP 密码
- `API_KEY`: 你的通知 api key (强烈建议设置, 因为不设置这个 api key 你无法及时知晓运行状态)
即可, 完成之后, 每天 UTC 0 点就会进行填报, (北京时间 8 点).
# 跋
只接受PR不接受需求。
# 致谢
- 感谢 [karuboniru](https://github.com/IanSmith123/ucas-covid19/pull/1) 提供的github actions 支持
<a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/3.0/"><img alt="知识共享许可协议" style="border-width:0" src="https://i.creativecommons.org/l/by-nc-sa/3.0/88x31.png" /></a><br />本作品采用<a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/3.0/">知识共享署名-非商业性使用-相同方式共享 3.0 未本地化版本许可协议</a>进行许可。

View File

@@ -12,8 +12,8 @@ from datetime import datetime
s = requests.Session()
user = "" # sep账号
passwd = "" # sep密码
user = "USERNAME" # sep账号
passwd = "PASSWORD" # sep密码
api_key = "" # server酱的api填了可以微信通知打卡结果不填没影响

6
sub.py
View File

@@ -11,9 +11,9 @@ from datetime import datetime
s = requests.Session()
user = "" # sep账号
passwd = "" # sep密码
api_key = "" # server酱的api填了可以微信通知打卡结果不填没影响
user = "USERNAME" # sep账号
passwd = "PASSWORD" # sep密码
api_key = "API_KEY" # server酱的api填了可以微信通知打卡结果不填没影响
def login(s: requests.Session, username, password):