Update the project structure by moving the Python script files to a folder called "scripts" and the data files to a folder called "data" to organize the project files more clearly.

This commit is contained in:
NianBroken
2024-05-22 10:06:54 +08:00 Unverified
parent 7e36dcd934
commit a5fcd627ca
11 changed files with 18 additions and 15 deletions
-1
View File
@@ -1 +0,0 @@
cc20700204d06fbeb5498cf0078f3725
-1
View File
@@ -1 +0,0 @@
09975406912bb31cacc59f2573b68768
+15 -9
View File
@@ -3,11 +3,11 @@ import re
import hashlib import hashlib
import os import os
import shutil import shutil
from user_login import login from .scripts.user_login import login
from get_user_info import get_user_info from .scripts.get_user_info import get_user_info
from get_grade import get_grade from .scripts.get_grade import get_grade
from get_selected_courses import get_selected_courses from .scripts.get_selected_courses import get_selected_courses
from pushplus import send_message from .scripts.pushplus import send_message
from datetime import datetime from datetime import datetime
@@ -39,9 +39,10 @@ github_step_summary = os.environ.get("GITHUB_STEP_SUMMARY")
force_push_message = force_push_message == "True" if github_actions else True force_push_message = force_push_message == "True" if github_actions else True
# 定义文件路径 # 定义文件路径
info_file_path = "info.txt" folder_path = "data"
grade_file_path = "grade.txt" info_file_path = os.path.join(folder_path, "info.txt")
old_grade_file_path = "old_grade.txt" grade_file_path = os.path.join(folder_path, "grade.txt")
old_grade_file_path = os.path.join(folder_path, "old_grade.txt")
# 初始化运行次数 # 初始化运行次数
run_count = 2 run_count = 2
@@ -67,6 +68,10 @@ integrated_info = get_user_info(student_client, output_type="integrated_info")
# 加密个人信息 # 加密个人信息
encrypted_info = md5_encrypt(info) encrypted_info = md5_encrypt(info)
# 检查文件夹是否存在,如果不存在则创建
if not os.path.exists(folder_path):
os.makedirs(folder_path)
# 判断info.txt文件是否存在 # 判断info.txt文件是否存在
if not os.path.exists(info_file_path): if not os.path.exists(info_file_path):
# 如果文件不存在,创建并写入加密后的个人信息 # 如果文件不存在,创建并写入加密后的个人信息
@@ -209,7 +214,8 @@ if run_log:
# 删除 __pycache__ 缓存目录及其内容 # 删除 __pycache__ 缓存目录及其内容
current_directory = os.getcwd() current_directory = os.getcwd()
cache_folder = os.path.join(current_directory, "__pycache__") scripts_folder = os.path.join(current_directory, "scripts")
cache_folder = os.path.join(scripts_folder, "__pycache__")
# 检查目录是否存在 # 检查目录是否存在
if os.path.exists(cache_folder): if os.path.exists(cache_folder):
# 删除目录及其内容 # 删除目录及其内容
-1
View File
@@ -1 +0,0 @@
cc20700204d06fbeb5498cf0078f3725
@@ -1,5 +1,5 @@
import traceback import traceback
from get_grade import get_grade from .get_grade import get_grade
def get_selected_courses(student_client): def get_selected_courses(student_client):
@@ -1,4 +1,4 @@
from get_grade import get_grade from .get_grade import get_grade
import traceback import traceback
View File
+1 -1
View File
@@ -2,7 +2,7 @@ import base64
import os import os
import sys import sys
from pprint import pprint from pprint import pprint
from zfn_api import Client from .zfn_api import Client
def login(url, username, password): def login(url, username, password):
View File