Browse Source

fix: use absolute path to read users.txt(#master)

master
OhYee 3 years ago
parent
commit
814a864e5f
Signed by: OhYee
GPG Key ID: 5A9E1F63ED274FBB
  1. 3
      check/check.py
  2. 3
      leave/leave.py

3
check/check.py

@ -2,6 +2,7 @@ import requests @@ -2,6 +2,7 @@ import requests
import datetime
import re
import json
import os
session = requests.Session()
@ -64,7 +65,7 @@ def check(username: str, password: str): @@ -64,7 +65,7 @@ def check(username: str, password: str):
if __name__ == "__main__":
with open("./users.txt") as f:
with open(os.path.join(os.path.dirname(__file__), "users.txt")) as f:
users = f.read().split("\n")
for u in users:
try:

3
leave/leave.py

@ -4,6 +4,7 @@ import requests @@ -4,6 +4,7 @@ import requests
import datetime
import re
import yaml
import os
session = requests.Session()
schools = {
@ -111,7 +112,7 @@ def leave( @@ -111,7 +112,7 @@ def leave(
if __name__ == "__main__":
with open("./users.txt") as f:
with open(os.path.join(os.path.dirname(__file__), "users.txt")) as f:
users = yaml.load_all(f, Loader=yaml.FullLoader)
for u in users:
try:

Loading…
Cancel
Save