[O] Use toml instead of environ to store user and pass

This commit is contained in:
Azalea Gui
2023-02-04 02:34:36 -05:00
parent a1272f0eb1
commit 512e438ca0
3 changed files with 12 additions and 1 deletions
+2
View File
@@ -0,0 +1,2 @@
login = "meow@example.com"
passwd = "qwq"
+9 -1
View File
@@ -1,3 +1,4 @@
import argparse
import os import os
import sys import sys
import threading import threading
@@ -9,6 +10,7 @@ from typing import Literal
from urllib.parse import urlparse, parse_qs from urllib.parse import urlparse, parse_qs
import requests import requests
import toml
from hypy_utils import json_stringify from hypy_utils import json_stringify
from hypy_utils.serializer import pickle_decode, pickle_encode from hypy_utils.serializer import pickle_decode, pickle_encode
@@ -219,7 +221,13 @@ class Handler(BaseHTTPRequestHandler):
if __name__ == '__main__': if __name__ == '__main__':
print(login(os.environ['user'], os.environ['pass'])) par = argparse.ArgumentParser("Superbuy Order Helper")
par.add_argument("-a", "--auth", help="Auth config path", default="auth.toml")
args = par.parse_args()
auth = toml.loads(Path(args.auth).read_text())
print(login(auth['login'], auth['passwd']))
# Start HTTP server asyncronously # Start HTTP server asyncronously
server = HTTPServer(("127.0.0.1", 12842), Handler) server = HTTPServer(("127.0.0.1", 12842), Handler)
+1
View File
@@ -3,3 +3,4 @@ fastapi
hypy_utils hypy_utils
uvicorn uvicorn
pysocks pysocks
toml