增加报错的具体显示内容,方便调试
This commit is contained in:
parent
d3f8288911
commit
61047c1ac9
@ -14,7 +14,7 @@ import shutil
|
||||
from flask import Flask, request, render_template, g, Blueprint, send_file, make_response, session
|
||||
from pywxdump import analyzer, read_img_dat, read_audio, get_wechat_db, get_core_db
|
||||
from pywxdump.api.rjson import ReJson, RqJson
|
||||
from pywxdump.api.utils import read_session, save_session
|
||||
from pywxdump.api.utils import read_session, save_session, error9999
|
||||
from pywxdump import read_info, VERSION_LIST, batch_decrypt, BiasAddr, merge_db, decrypt_merge
|
||||
import pywxdump
|
||||
|
||||
@ -25,19 +25,19 @@ api.debug = False
|
||||
|
||||
|
||||
@api.route('/api/init', methods=["GET", 'POST'])
|
||||
@error9999
|
||||
def init():
|
||||
"""
|
||||
初始化 设置微信数据库路径,图片路径,解密需要的数据库
|
||||
:return:
|
||||
"""
|
||||
try:
|
||||
msg_path = request.json.get("msg_path", "").strip()
|
||||
micro_path = request.json.get("micro_path", "").strip()
|
||||
media_path = request.json.get("media_path", "").strip()
|
||||
wx_path = request.json.get("wx_path", "").strip()
|
||||
key = request.json.get("key", "").strip()
|
||||
my_wxid = request.json.get("my_wxid", "").strip()
|
||||
|
||||
raise Exception("test")
|
||||
if key: # 如果key不为空,表示是解密模式
|
||||
if not wx_path:
|
||||
return ReJson(1002)
|
||||
@ -99,10 +99,6 @@ def init():
|
||||
}
|
||||
return ReJson(0, rdata)
|
||||
|
||||
except Exception as e:
|
||||
rdata = f"{e.__traceback__.tb_lineno}____{e.__traceback__.tb_frame.f_globals['__file__']}____{e}"
|
||||
return ReJson(9999, body=rdata)
|
||||
|
||||
|
||||
@api.route('/api/version', methods=["GET", 'POST'])
|
||||
def version():
|
||||
|
@ -6,6 +6,10 @@
|
||||
# Date: 2024/01/16
|
||||
# -------------------------------------------------------------------------------
|
||||
import json
|
||||
import logging
|
||||
import traceback
|
||||
from .rjson import ReJson
|
||||
from functools import wraps
|
||||
|
||||
|
||||
def read_session(session_file, arg):
|
||||
@ -26,5 +30,14 @@ def save_session(session_file, arg, value):
|
||||
return True
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
pass
|
||||
def error9999(func):
|
||||
@wraps(func)
|
||||
def wrapper(*args, **kwargs):
|
||||
try:
|
||||
return func(*args, **kwargs)
|
||||
except Exception as e:
|
||||
traceback_data = traceback.format_exc()
|
||||
rdata = f"{traceback_data}"
|
||||
return ReJson(9999, body=rdata)
|
||||
|
||||
return wrapper
|
||||
|
Loading…
Reference in New Issue
Block a user