Giter Site home page Giter Site logo

hitsz-daily-report's Introduction

HITsz Daily Report

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

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

免责声明

本脚本为减轻导员和负责人/班长通知成本而诞生,作者不对任何因个人瞒报而破坏疫情防治工作的行为负责!

如果有发热状况,请及时私信通知导员!!!!

如果有发热状况,请及时私信通知导员!!!!

如果有发热状况,请及时私信通知导员!!!!

使用方法

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

声明

用户使用过程中输入的账户、密码等信息仅用做登陆认证凭据,脚本未对任何个人信息与登陆凭据进行非法留存、转发等操作,尽情放心使用。欢迎核查。

hitsz-daily-report's People

Contributors

chh13502 avatar jalinwang avatar jellybeanxiewh avatar rmanluo avatar virfunc avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

hitsz-daily-report's Issues

【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.

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.

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

关于上报地址

请问更新后的程序上报的地址是默认在深圳还是会自动根据上一次上报的地址来上报?

最近还是一直运行失败

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.

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.