Skip to content

Commit 3cd73d2

Browse files
committed
fix(main.py): 修复download.py调用报错的原因
TypeError: check_file_exists() missing 1 required positional argument: 'file_path' Signed-off-by: YanMo <xiajiaruimail@qq.com>
1 parent 84e66a8 commit 3cd73d2

File tree

2 files changed

+31
-20
lines changed

2 files changed

+31
-20
lines changed

download.py

+8-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
from tqdm import tqdm
1111

12+
import asyncio
1213
import io
1314
import platform
1415
import aiohttp
@@ -43,7 +44,7 @@ async def download_frp(url, file_name):
4344
print(f"文件 {file_name} 下载完成。")
4445

4546

46-
def check_file_exists(file_path):
47+
async def check_file_exists(file_path):
4748
return os.path.exists(file_path)
4849

4950

@@ -98,3 +99,9 @@ async def main():
9899
]
99100
file_name = "frp_LoCyanFrp-0.51.3_windows_amd64.zip"
100101
await download_frp(url_list, file_name)
102+
await unzip_file(file_name)
103+
await check_frp_exists()
104+
105+
106+
if __name__ == "__main__":
107+
asyncio.run(main())

main.py

+23-19
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import urllib3
22
import requests
33
import download
4+
import asyncio
45

56
from launch import *
67

@@ -21,28 +22,31 @@ def __init__(self):
2122
# 关闭urllib3不验证SSL产生的报错
2223
urllib3.disable_warnings()
2324

24-
# 检查更新
25-
version = "version_1.0.1"
25+
async def async_init(self):
26+
# 检查更新
27+
version = "version_1.0.1"
2628

27-
check_update_url = f"https://api.ymbit.cn/public/check_update/{version}.html"
28-
check_update = requests.get(check_update_url, verify=False)
29+
check_update_url = (
30+
f"https://api.ymbit.cn/public/check_update/{version}.html"
31+
)
32+
check_update = requests.get(check_update_url, verify=False)
2933

30-
if check_update.status_code == 200:
31-
download.check_file_exists()
32-
elif check_update.status_code == 404:
33-
print("目前 LoCyanPyLauncher 非最新版本,请前往 GitHub 更新。")
34-
else:
35-
print("检查更新失败,请检查网络连接。")
36-
sys.exit(1)
34+
if check_update.status_code == 200:
35+
await download.check_frp_exists()
36+
elif check_update.status_code == 404:
37+
print("目前 LoCyanPyLauncher 非最新版本,请前往 GitHub 更新。")
38+
else:
39+
print("检查更新失败,请检查网络连接。")
40+
sys.exit(1)
3741

38-
print("欢迎使用LoCyan Frp Application")
39-
result = self.r.get("https://api.locyanfrp.cn/App", verify=False)
40-
result = result.json()
41-
contents = result["contents"]
42-
print("------------------------------------------------")
43-
print("公告:")
44-
print(contents)
45-
print("------------------------------------------------")
42+
print("欢迎使用LoCyan Frp Application")
43+
result = self.r.get("https://api.locyanfrp.cn/App", verify=False)
44+
result = result.json()
45+
contents = result["contents"]
46+
print("------------------------------------------------")
47+
print("公告:")
48+
print(contents)
49+
print("------------------------------------------------")
4650

4751
def get_user_info(
4852
self, node: str, code: str

0 commit comments

Comments
 (0)