基于Github Action的定时HITsz疫情上报脚本,开箱即用

Overview

HITsz Daily Report

基于 GitHub Actions 的「HITsz 疫情系统」访问入口 定时自动上报脚本,开箱即用。

感谢 @JellyBeanXiewh 提供原始脚本和 idea。
感谢 @bugstop 对脚本进行重构并新增 Easy Connect 校内代理访问。

使用方法

  1. Fork 仓库
  2. 设置仓库的 Actions Secrets 如何设置?
    添加用户名 USERNAME 和密码 PASSWORD ,以及可选的 GRADUATINGAPI_KEY
    Name Value
    USERNAME HITsz 统一身份认证用户名(学号)
    PASSWORD HITsz 统一身份认证密码
    GRADUATING 毕业班请设为 1 ,非毕业班学生请留空(不设置)
    API_KEY 微信推送的 sckey 如何申请?,不需要请留空(不设置)
  3. 开启 GitHub Actions 如何开启?
  4. 每天早上 7:00 23:00 UTC 定时自动运行
    如果填写 API_KEY ,即可在微信上收到运行结果推送(由 Server 酱提供)
    或者你可以打开 GitHub Actions 执行的全局邮件通知 如何开启?,包括成功或失败信息

Change Log

参阅 Releases 列表。

You might also like...
Comments
  • 2021.9.15脚本执行失败

    2021.9.15脚本执行失败

    执行log

    2021-09-15 00:40:13,420 - INFO - 非毕业班学生,微信提醒开启,VPN 开启。
    2021-09-15 00:40:18,444 - INFO - 认证系统登录成功。
    2021-09-15 00:40:18,955 - CRITICAL - 上报失败!其他错误:Expecting value: line 2 column 1 (char 1)
    2021-09-15 00:40:20,827 - INFO - 微信提醒消息已发送。
    Traceback (most recent call last):
      File "/home/runner/work/HITsz-daily-report/HITsz-daily-report/report.py", line 236, in <module>
        main(arguments)
      File "/home/runner/work/HITsz-daily-report/HITsz-daily-report/report.py", line 214, in main
        module_id = r.student_report_check()
      File "/home/runner/work/HITsz-daily-report/HITsz-daily-report/report.py", line 143, in student_report_check
        result = response.json()
      File "/opt/hostedtoolcache/Python/3.9.6/x64/lib/python3.9/site-packages/requests/models.py", line 910, in json
        return complexjson.loads(self.text, **kwargs)
      File "/opt/hostedtoolcache/Python/3.9.6/x64/lib/python3.9/json/__init__.py", line 346, in loads
        return _default_decoder.decode(s)
      File "/opt/hostedtoolcache/Python/3.9.6/x64/lib/python3.9/json/decoder.py", line 337, in decode
        obj, end = self.raw_decode(s, idx=_w(s, 0).end())
      File "/opt/hostedtoolcache/Python/3.9.6/x64/lib/python3.9/json/decoder.py", line 355, in raw_decode
        raise JSONDecodeError("Expecting value", s, err.value) from None
    json.decoder.JSONDecodeError: Expecting value: line 2 column 1 (char 1)
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "/home/runner/work/HITsz-daily-report/HITsz-daily-report/report.py", line 248, in <module>
        raise ReportException(report_msg)
    __main__.ReportException: 上报失败!其他错误:Expecting value: line 2 column 1 (char 1)
    Error: Process completed with exit code 1.
    

    可能是由于疫情上报系统启用了自动定位所致?

    bug working on it 
    opened by lizbaka 7
  • 【Action 执行失败】登陆失败!原因:无可用代理。

    【Action 执行失败】登陆失败!原因:无可用代理。

    错误信息如下

    Run python report.py "$USERNAME" "$PASSWORD" -g="$GRADUATING" -k="$API_KEY" -p
    2021-10-06 23:08:39,621 - INFO - 非毕业班学生,微信提醒关闭,VPN 开启。
    2021-10-06 23:10:48,911 - ERROR - HTTPSConnectionPool(host='xgsm.hitsz.edu.cn', port=443): Max retries exceeded with url: /zhxy-xgzs/xg_mobile/shsj/common (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7fe9c8a4ab20>: Failed to establish a new connection: [Errno 110] Connection timed out'))
    2021-10-06 23:10:48,912 - WARNING - 开启代理,将在 2 秒后重试。
    2021-10-06 23:15:13,103 - ERROR - 登陆失败!原因:无可用代理。
    Traceback (most recent call last):
      File "/opt/hostedtoolcache/Python/3.9.7/x64/lib/python3.9/site-packages/urllib3/connection.py", line 174, in _new_conn
        conn = connection.create_connection(
      File "/opt/hostedtoolcache/Python/3.9.7/x64/lib/python3.9/site-packages/urllib3/util/connection.py", line 96, in create_connection
        raise err
      File "/opt/hostedtoolcache/Python/3.9.7/x64/lib/python3.9/site-packages/urllib3/util/connection.py", line 86, in create_connection
        sock.connect(sa)
    TimeoutError: [Errno 110] Connection timed out
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "/opt/hostedtoolcache/Python/3.9.7/x64/lib/python3.9/site-packages/urllib3/connectionpool.py", line 699, in urlopen
        httplib_response = self._make_request(
      File "/opt/hostedtoolcache/Python/3.9.7/x64/lib/python3.9/site-packages/urllib3/connectionpool.py", line 382, in _make_request
        self._validate_conn(conn)
      File "/opt/hostedtoolcache/Python/3.9.7/x64/lib/python3.9/site-packages/urllib3/connectionpool.py", line 1010, in _validate_conn
        conn.connect()
      File "/opt/hostedtoolcache/Python/3.9.7/x64/lib/python3.9/site-packages/urllib3/connection.py", line 358, in connect
        conn = self._new_conn()
      File "/opt/hostedtoolcache/Python/3.9.7/x64/lib/python3.9/site-packages/urllib3/connection.py", line 186, in _new_conn
        raise NewConnectionError(
    urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPSConnection object at 0x7fe9c8a4ab20>: Failed to establish a new connection: [Errno 110] Connection timed out
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "/opt/hostedtoolcache/Python/3.9.7/x64/lib/python3.9/site-packages/requests/adapters.py", line 439, in send
        resp = conn.urlopen(
      File "/opt/hostedtoolcache/Python/3.9.7/x64/lib/python3.9/site-packages/urllib3/connectionpool.py", line 755, in urlopen
        retries = retries.increment(
      File "/opt/hostedtoolcache/Python/3.9.7/x64/lib/python3.9/site-packages/urllib3/util/retry.py", line 574, in increment
        raise MaxRetryError(_pool, url, error or ResponseError(cause))
    urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='xgsm.hitsz.edu.cn', port=443): Max retries exceeded with url: /zhxy-xgzs/xg_mobile/shsj/common (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7fe9c8a4ab20>: Failed to establish a new connection: [Errno 110] Connection timed out'))
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "/home/runner/work/HITsz-daily-report/HITsz-daily-report/report.py", line 214, in main
        r.student_login()
      File "/home/runner/work/HITsz-daily-report/HITsz-daily-report/report.py", line 104, in student_login
        response = self.session.get(url_sso, proxies=self.proxies)
      File "/opt/hostedtoolcache/Python/3.9.7/x64/lib/python3.9/site-packages/requests/sessions.py", line 555, in get
        return self.request('GET', url, **kwargs)
      File "/opt/hostedtoolcache/Python/3.9.7/x64/lib/python3.9/site-packages/requests/sessions.py", line 542, in request
        resp = self.send(prep, **send_kwargs)
      File "/opt/hostedtoolcache/Python/3.9.7/x64/lib/python3.9/site-packages/requests/sessions.py", line 655, in send
        r = adapter.send(request, **kwargs)
      File "/opt/hostedtoolcache/Python/3.9.7/x64/lib/python3.9/site-packages/requests/adapters.py", line 516, in send
        raise ConnectionError(e, request=request)
    requests.exceptions.ConnectionError: HTTPSConnectionPool(host='xgsm.hitsz.edu.cn', port=443): Max retries exceeded with url: /zhxy-xgzs/xg_mobile/shsj/common (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7fe9c8a4ab20>: Failed to establish a new connection: [Errno 110] Connection timed out'))
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "/home/runner/work/HITsz-daily-report/HITsz-daily-report/report.py", line 249, in <module>
        main(arguments)
      File "/home/runner/work/HITsz-daily-report/HITsz-daily-report/report.py", line 224, in main
        r.switch_proxies(r.student_login)
      File "/home/runner/work/HITsz-daily-report/HITsz-daily-report/report.py", line 97, in switch_proxies
        raise ReportException.LoginError("无可用代理。")
    __main__.LoginError: 无可用代理。
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "/home/runner/work/HITsz-daily-report/HITsz-daily-report/report.py", line 254, in <module>
        raise ReportException(report_msg)
    __main__.ReportException: 登陆失败!原因:无可用代理。
    Error: Process completed with exit code 1.
    
    opened by BurgessX 2
  • 最近还是一直运行失败

    最近还是一直运行失败

    Run python report.py "$USERNAME" "$PASSWORD" -g="$GRADUATING" -k="$API_KEY" -p python report.py "$USERNAME" "$PASSWORD" -g="$GRADUATING" -k="$API_KEY" -p shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0} env: pythonLocation: /opt/hostedtoolcache/Python/3.9.7/x64 LD_LIBRARY_PATH: /opt/hostedtoolcache/Python/3.9.7/x64/lib USERNAME: *** PASSWORD: *** GRADUATING: API_KEY: 2021-09-26 01:52:30,374 - INFO - 非毕业班学生,微信提醒关闭,VPN 开启。 2021-09-26 01:52:35,486 - INFO - 认证系统登录成功。 2021-09-26 01:52:36,028 - CRITICAL - 上报失败!其他错误:Expecting value: line 2 column 1 (char 1) Traceback (most recent call last): File "/home/runner/work/HITsz-daily-report/HITsz-daily-report/report.py", line 236, in main(arguments) File "/home/runner/work/HITsz-daily-report/HITsz-daily-report/report.py", line 214, in main module_id = r.student_report_check() File "/home/runner/work/HITsz-daily-report/HITsz-daily-report/report.py", line 143, in student_report_check result = response.json() File "/opt/hostedtoolcache/Python/3.9.7/x64/lib/python3.9/site-packages/requests/models.py", line 910, in json return complexjson.loads(self.text, **kwargs) File "/opt/hostedtoolcache/Python/3.9.7/x64/lib/python3.9/json/init.py", line 346, in loads return _default_decoder.decode(s) File "/opt/hostedtoolcache/Python/3.9.7/x64/lib/python3.9/json/decoder.py", line 337, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) File "/opt/hostedtoolcache/Python/3.9.7/x64/lib/python3.9/json/decoder.py", line 355, in raw_decode raise JSONDecodeError("Expecting value", s, err.value) from None json.decoder.JSONDecodeError: Expecting value: line 2 column 1 (char 1)

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last): File "/home/runner/work/HITsz-daily-report/HITsz-daily-report/report.py", line 248, in raise ReportException(report_msg) main.ReportException: 上报失败!其他错误:Expecting value: line 2 column 1 (char 1) Error: Process completed with exit code 1.

    opened by 45153 0
Releases(v1.0)
  • v1.0(May 5, 2021)

    已经稳定运行1个月,发布首个正式版。

    功能列表

    • 每日定时新增记录并填写
    • 可选是否为毕业班学生
    • 消息通知:目前支持 微信推送(由 Server 酱 提供,也可手动开启 GitHub Actions 执行的全局邮件通知 如何开启?

    Change log:

    • 修复一系列bug + 代码重构
    • 新增 毕业班 选项 #8 #4
    • 由于疫情上报系统限制内网访问,因而接入了Easy Connect #7
    Source code(tar.gz)
    Source code(zip)
Using Python and Pushshift.io to Track stocks on the WallStreetBets subreddit

wallstreetbets-tracker Using Python and Pushshift.io to Track stocks on the WallStreetBets subreddit.

91 Dec 08, 2022
A way to scrape sports streams for use with Jellyfin.

Sportyfin Description Stream sports events straight from your Jellyfin server. Sportyfin allows users to scrape for live streamed events and watch str

axelmierczuk 38 Nov 05, 2022
This is my CS 20 final assesment.

eeeeeSpider This is my CS 20 final assesment. How to use: Open program Run to your hearts content! There are no external dependancies that you will ha

1 Jan 17, 2022
Searching info from Google using Python Scrapy

Python-Search-Engine-Scrapy || Python-爬虫-索引/利用爬虫获取谷歌信息**/ Searching info from Google using Python Scrapy /* 利用 PYTHON 爬虫获取天气信息,以及城市信息和资料**/ translatio

HONGVVENG 1 Jan 06, 2022
淘宝茅台抢购最新优化版本,淘宝茅台秒杀,优化了茅台抢购线程队列

淘宝茅台抢购最新优化版本,淘宝茅台秒杀,优化了茅台抢购线程队列

MaoTai 118 Dec 16, 2022
A leetcode scraper to compile all questions in leetcode free tier to text file. pdf also available.

A leetcode scraper to compile all questions in leetcode free tier to text file, pdf also available. if new questions get added, run again to get new questions.

3 Dec 07, 2021
Distributed Crawler Management Framework Based on Scrapy, Scrapyd, Django and Vue.js

Gerapy Distributed Crawler Management Framework Based on Scrapy, Scrapyd, Scrapyd-Client, Scrapyd-API, Django and Vue.js. Documentation Documentation

Gerapy 2.9k Jan 03, 2023
Html Content / Article Extractor, web scrapping lib in Python

Python-Goose - Article Extractor Intro Goose was originally an article extractor written in Java that has most recently (Aug2011) been converted to a

Xavier Grangier 3.8k Jan 02, 2023
Web scraper for Zillow

Zillow-Scraper Instructions All terminal commands are highlighted. Make sure you first have python 3 installed. You can check this by running "python

Ali Rastegar 1 Nov 23, 2021
一个m3u8视频流下载脚本

一个Python的m3u8流视频下载脚本 介绍 m3u8流视频日益常见,目前好用的下载器也有很多,我把之前自己写的一个小脚本分享出来,供广大网友使用。写此程序的目的在于给视频下载爱好者提供一个下载样例,可直接调用,勿再重复造轮子。 使用方法 在python中直接运行程序或进行外部调用 import

Nchu 0 Oct 10, 2021
Web Scraping OLX with Python and Bsoup.

webScrap WebScraping first step. Authors: Paulo, Claudio M. First steps in Web Scraping. Project carried out for training in Web Scrapping. The export

claudio paulo 5 Sep 25, 2022
A Web Scraping Program.

Web Scraping AUTHOR: Saurabh G. MTech Information Security, IIT Jammu. If you find this repository useful. I would appreciate if you Star it and Fork

Saurabh G. 2 Dec 14, 2022
A universal package of scraper scripts for humans

Scrapera is a completely Chromedriver free package that provides access to a variety of scraper scripts for most commonly used machine learning and data science domains.

299 Dec 15, 2022
fork huanghyw/jd_seckill

Jd_Seckill 特别声明: 本仓库发布的jd_seckill项目中涉及的任何脚本,仅用于测试和学习研究,禁止用于商业用途,不能保证其合法性,准确性,完整性和有效性,请根据情况自行判断。 本项目内所有资源文件,禁止任何公众号、自媒体进行任何形式的转载、发布。

512 Jan 03, 2023
Grab the changelog from releases on Github

release-notes-scraper This simple script can be used to grab the release notes for projects from github that do not keep a CHANGELOG, but publish thei

Dan Čermák 4 Apr 01, 2022
Scrapegoat is a python library that can be used to scrape the websites from internet based on the relevance of the given topic irrespective of language using Natural Language Processing

Scrapegoat is a python library that can be used to scrape the websites from internet based on the relevance of the given topic irrespective of language using Natural Language Processing. It can be ma

10 Jul 06, 2022
Unja is a fast & light tool for fetching known URLs from Wayback Machine

Unja Fetch Known Urls What's Unja? Unja is a fast & light tool for fetching known URLs from Wayback Machine, Common Crawl, Virus Total & AlienVault's

Sheryar 10 Aug 07, 2022
a small library for extracting rich content from urls

A small library for extracting rich content from urls. what does it do? micawber supplies a few methods for retrieving rich metadata about a variety o

Charles Leifer 588 Dec 27, 2022
download NCERT books using scrapy

download_ncert_books download NCERT books using scrapy Downloading Books: You can either use the spider by cloning this repo and following the instruc

1 Dec 02, 2022
a Scrapy spider that utilizes Postgres as a DB, Squid as a proxy server, Redis for de-duplication and Splash to render JavaScript. All in a microservices architecture utilizing Docker and Docker Compose

This is George's Scraping Project To get started cd into the theZoo file and run: chmod +x script.sh then: ./script.sh This will spin up a Postgres co

George Reyes 7 Nov 27, 2022