From c6814b9765a6b468610728feb4fcd6bb34f5e3fe Mon Sep 17 00:00:00 2001 From: mshe <666666666@666666666.666666666> Date: Mon, 8 Jun 2026 17:31:58 +0800 Subject: [PATCH] fix bugs --- app.py | 5 ++--- spider/mail_qq.py | 5 +++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app.py b/app.py index e973e17..c230184 100755 --- a/app.py +++ b/app.py @@ -13,7 +13,7 @@ mcp = FastMCP("spider-server") VNC_SERVER_HOST = "https://10.10.40.19:6080" SHELL_DIR = "/home/dgs/vnc-server" @mcp.tool() -async def mail_qq_spider(account: str,display: int) -> str: +async def mail_qq_spider(account: str,display: int) -> str: """qq邮箱爬虫,第一个参数是用户名 Args: account: qq邮箱用户名 @@ -23,8 +23,7 @@ async def mail_qq_spider(account: str,display: int) -> str: """ data={"display": display} try: - os.environ['DISPLAY'] = f':{display}' - result = await asyncio.to_thread(start_mail_qq_spider, account) + result = await asyncio.to_thread(start_mail_qq_spider, account,display) data["status"] = 200 data["result"] = result return json.dumps(data, ensure_ascii=False) diff --git a/spider/mail_qq.py b/spider/mail_qq.py index d5888c3..e213992 100644 --- a/spider/mail_qq.py +++ b/spider/mail_qq.py @@ -111,7 +111,8 @@ def crawl_with_saved_state(auth_file): browser.close() -def start(account): +def start(account, display=0): + os.environ['DISPLAY'] = f':{display}' logging.info(f"用户名{account}") if not account: logging.error("请输入用户名") @@ -133,4 +134,4 @@ def start(account): save_login_state(file_path, "收件箱") if __name__ == '__main__': - start("123") \ No newline at end of file + start("123",display=1) \ No newline at end of file