Used to record WKU's utility bills on a regular basis.

Overview

WKU水电费小助手

一个用于定期记录WKU水电费的脚本

Looking for English Readme?

背景

由于WKU校园内的水电账单系统时常存在扣费延迟的现象,而补扣的费用缺乏令人信服的证明。不少学生为费用摸不着头脑,但也没有申诉的依据。为了更好地掌握水电费使用情况,留下一手证据,我开源了这个自动化脚本。配合定时任务,它可以根据设定的时间间隔,自动查询当前的剩余的水电费情况,并形成记录。

安装以及部署

步骤#1: 捕获必要的验证信息

在获取水电费数据过程中,Cookie是通过身份认证的必要元素。为了抓取用于认证的数据包,我从微信公众号 ”温州肯恩大学校园卡 “下的“一卡通充值”服务入手。

提示:在本篇教程中,我使用Fiddler作为抓包工具。

步骤#1.1: 启用对HTTPS流量的捕获功能

由于我们获取Cookie所需的参数是通过HTTPS通信的,所以我们必须确保在开始之前,抓包软件已经启用了这个功能。

fiddler_https

步骤#1.2: 抓取微信公众号下H5网页的HTTPS请求

在抓包软件开始正常抓包后,我们打开微信公众号 ”温州肯恩大学校园卡 “并依次点击 "校园服务"、"一卡通充值"、"缴水费"。

步骤#1.3: 获得验证数据

最后一步! 我们从抓包软件中找到请求头为 "POST /app/login/getThirdUserAuthorize HTTP/1.1"的请求。在文本视图中复制ymTokenymUserId备用。

fiddler_data

提示:如果文本包含特殊符号,你需要将其转换为ASCII码。例如,"="需要转换为"%3D"。

步骤#2:安装Python脚本的依赖包

这个项目使用了Python3以及相关的依赖包,请确保你已经安装了它们。

pip install -r requirements.txt

步骤#3: 获取你寝室的areaCode

步骤#3.1: 填入验证数据

还记得我们在第一步获取的ymTokenymUserId嘛?将它们复制到我所提供的两个脚本中。

example_ym

步骤#3.2: 执行firstRun.py

在firstRun脚本中,你需要按照提示依次选择所属楼栋、所在楼层以及寝室号。

python firstRun.py

Step#3.3: 获取areaCode

复制脚本提供的areaCode,以便之后部署水电费记录机器人。

example_firstRun

提示:如果显示的水电费与微信公众号不一样,请通过问题板块告诉我(或者见面告诉我)

第4步:部署水电费记录机器人

步骤#4.1: 执行logRobot.py

python logRobot.py "your_area_code"

example_logRobot

提示:areaCode参数需要用引号括起来,否则记录机器人会报错。

执行后,在当前目录下会产生一个以areaCode为名称的txt文件。时间和对应的水电费会被记录在其中。

example_logFile

步骤#4.2: 将机器人部署在你想要部署的地方

该脚本目前部署在我的私人NAS上,并通过crontab定期进行记录。下面是我设置的crontab任务。

0 */4 * * * cd /data/fee && /usr/bin/python3 logRobot.py [areaCode]

拓展

这个脚本在轻量改写后可以在钉钉中实现缴费预警的功能。代码会在以后公布(可能会吧 老鸽子了orz)

example_dingReport

You might also like...
alfred-py: A deep learning utility library for **human**
alfred-py: A deep learning utility library for **human**

Alfred Alfred is command line tool for deep-learning usage. if you want split an video into image frames or combine frames into a single video, then a

Cl datasets - PyTorch image dataloaders and utility functions to load datasets for supervised continual learning

Continual learning datasets Introduction This repository contains PyTorch image

A Dying Light 2 (DL2) PAKFile Utility for Modders and Mod Makers.

Dying Light 2 PAKFile Utility A Dying Light 2 (DL2) PAKFile Utility for Modders and Mod Makers. This tool aims to make PAKFile (.pak files) modding a

Python utility to generate filesystem content for Obsidian.
Python utility to generate filesystem content for Obsidian.

Security Vault Generator Quickly parse, format, and output common frameworks/content for Obsidian.md. There is a strong focus on MITRE ATT&CK because

A fast, scalable, high performance Gradient Boosting on Decision Trees library, used for ranking, classification, regression and other machine learning tasks for Python, R, Java, C++. Supports computation on CPU and GPU.
A fast, scalable, high performance Gradient Boosting on Decision Trees library, used for ranking, classification, regression and other machine learning tasks for Python, R, Java, C++. Supports computation on CPU and GPU.

Website | Documentation | Tutorials | Installation | Release Notes CatBoost is a machine learning method based on gradient boosting over decision tree

A fast, distributed, high performance gradient boosting (GBT, GBDT, GBRT, GBM or MART) framework based on decision tree algorithms, used for ranking, classification and many other machine learning tasks.

Light Gradient Boosting Machine LightGBM is a gradient boosting framework that uses tree based learning algorithms. It is designed to be distributed a

A fast, scalable, high performance Gradient Boosting on Decision Trees library, used for ranking, classification, regression and other machine learning tasks for Python, R, Java, C++. Supports computation on CPU and GPU.
A fast, scalable, high performance Gradient Boosting on Decision Trees library, used for ranking, classification, regression and other machine learning tasks for Python, R, Java, C++. Supports computation on CPU and GPU.

Website | Documentation | Tutorials | Installation | Release Notes CatBoost is a machine learning method based on gradient boosting over decision tree

the code used for the preprint Embedding-based Instance Segmentation of Microscopy Images.
the code used for the preprint Embedding-based Instance Segmentation of Microscopy Images.

EmbedSeg Introduction This repository hosts the version of the code used for the preprint Embedding-based Instance Segmentation of Microscopy Images.

This repository contains the code used for Predicting Patient Outcomes with Graph Representation Learning (https://arxiv.org/abs/2101.03940).
This repository contains the code used for Predicting Patient Outcomes with Graph Representation Learning (https://arxiv.org/abs/2101.03940).

Predicting Patient Outcomes with Graph Representation Learning This repository contains the code used for Predicting Patient Outcomes with Graph Repre

Owner
null
Code release for NeX: Real-time View Synthesis with Neural Basis Expansion

NeX: Real-time View Synthesis with Neural Basis Expansion Project Page | Video | Paper | COLAB | Shiny Dataset We present NeX, a new approach to novel

null 536 Dec 20, 2022
Code for Mesh Convolution Using a Learned Kernel Basis

Mesh Convolution This repository contains the implementation (in PyTorch) of the paper FULLY CONVOLUTIONAL MESH AUTOENCODER USING EFFICIENT SPATIALLY

Yi_Zhou 35 Jan 3, 2023
NBEATSx: Neural basis expansion analysis with exogenous variables

NBEATSx: Neural basis expansion analysis with exogenous variables We extend the NBEATS model to incorporate exogenous factors. The resulting method, c

Cristian Challu 100 Dec 31, 2022
Code release for NeX: Real-time View Synthesis with Neural Basis Expansion

NeX: Real-time View Synthesis with Neural Basis Expansion Project Page | Video | Paper | COLAB | Shiny Dataset We present NeX, a new approach to novel

null 538 Jan 9, 2023
The Agriculture Domain of ERPNext comes with features to record crops and land

Agriculture The Agriculture Domain of ERPNext comes with features to record crops and land, track plant, soil, water, weather analytics, and even trac

Frappe 21 Jan 2, 2023
AI virtual gym is an AI program which can be used to exercise and can be used to see if we are doing the exercises

AI virtual gym is an AI program which can be used to exercise and can be used to see if we are doing the exercises

null 4 Feb 13, 2022
Small utility to demangle Nim symbols in callgrind files

nim_callgrind A small utility to demangle Nim symbols from callgrind files. Usage Run your (Nim) program with something like this: valgrind --tool=cal

kraptor 3 Feb 15, 2022
Calculates carbon footprint based on fuel mix and discharge profile at the utility selected. Can create graphs and tabular output for fuel mix based on input file of series of power drawn over a period of time.

carbon-footprint-calculator Conda distribution ~/anaconda3/bin/conda install anaconda-client conda-build ~/anaconda3/bin/conda config --set anaconda_u

Seattle university Renewable energy research 7 Sep 26, 2022
Utility tools for the "Divide and Remaster" dataset, introduced as part of the Cocktail Fork problem paper

Divide and Remaster Utility Tools Utility tools for the "Divide and Remaster" dataset, introduced as part of the Cocktail Fork problem paper The DnR d

Darius Petermann 46 Dec 11, 2022