Skip to content

Commit

Permalink
✨ feat: add 甜汤接口
Browse files Browse the repository at this point in the history
  • Loading branch information
WhaleFell committed Apr 16, 2022
1 parent 15be73b commit bc8b904
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
9 changes: 8 additions & 1 deletion api.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
"url": "https://pg.eeagd.edu.cn/ks/public/kszc/zcyzm.jsmeb",
"method": "POST",
"header": "",
"data": "\"[phone]\""
"data": "[phone]"
},
{
"desc": "广东教育翔云",
Expand Down Expand Up @@ -565,5 +565,12 @@
"action": "register",
"channel": "sms"
}
},
{
"desc": "甜糖app",
"url": "http://tiantang.mogencloud.com/web/api/login/code?phone=[phone]",
"method": "POST",
"header": "",
"data": ""
}
]
Binary file modified flask_app/data.db
Binary file not shown.
9 changes: 6 additions & 3 deletions run_fask_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ def sqlite2json():
apis_ = []
for api in apis:
# print(api.url)
if api.data is None:
api.data = ""
if api.header is None:
api.header = ""
data = {
"desc": api.desc,
"url": api.url,
Expand All @@ -70,11 +74,10 @@ def sqlite2json():
apis_.append(api.dict())
except:
pass

data = json.loads(json_path.read_text(encoding='utf8'))
print(apis_)
with open(json_path, mode="w", encoding="utf8") as j:
try:
json.dump(data, j, ensure_ascii=False, sort_keys=False)
json.dump(apis_, j, ensure_ascii=False, sort_keys=False)
logger.success("sqlite->json 成功!")
except Exception:
logger.exception("写入到 json 文件错误!")
Expand Down

0 comments on commit bc8b904

Please sign in to comment.