aboutsummaryrefslogtreecommitdiff
path: root/calgen/ps.py
diff options
context:
space:
mode:
Diffstat (limited to 'calgen/ps.py')
-rw-r--r--calgen/ps.py49
1 files changed, 0 insertions, 49 deletions
diff --git a/calgen/ps.py b/calgen/ps.py
deleted file mode 100644
index 723473b..0000000
--- a/calgen/ps.py
+++ /dev/null
@@ -1,49 +0,0 @@
-# this is really hacky please don't use it
-# copyright (c) 2024 runxi yu
-# SPDX-License-Identifier: BSD-2-Clause
-
-import requests
-import os
-import sys
-import time
-import base64
-
-while True:
- ss = requests.Session()
- rq = ss.post(
- "https://powerschool.ykpaoschool.cn/guardian/home.html",
- data={
- "request_locale": "en_US",
- "account": sys.argv[1],
- "pw": os.environ[sys.argv[2]],
- "ldappassword": os.environ[sys.argv[2]],
- },
- )
- t = (
- ss.get("https://powerschool.ykpaoschool.cn/guardian/home.html")
- .text.replace("ISO-8859-1", "utf-8")
- .encode("utf-8")
- .decode("utf-8", "replace")
- )
- tl = t.lower()
- if "英文" in tl or "Math" in tl:
- print("\a\a\aSending email")
- with open("/tmp/ekekek.eml", "w") as p:
- p.write(
- "To: me@runxiyu.org\r\n"
- + "From: me@runxiyu.org\r\n"
- + "Subject: Timetable results\r\n"
- + 'Content-Type: text/html; charset="utf-8"\r\n'
- + "Content-Transfer-Encoding: base64\r\n"
- + "\r\n"
- + base64.standard_b64encode(t.encode("utf-8")).decode("utf-8", "error")
- )
- p.close()
- print(
- "\a\a\aDone! Sendmail finished with %s"
- % repr(os.system("/sbin/sendmail -i me@runxiyu.org < /tmp/ekekek.eml"))
- )
- break
- else:
- print(t)
- time.sleep(600)