Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions app/core/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,11 @@ def __mkdir(self) -> None:
"""
创建目录
"""
with self.CONFIG_DIR as dir_path:
if not dir_path.exists():
dir_path.mkdir(parents=True, exist_ok=True)
if not self.CONFIG_DIR.exists():
self.CONFIG_DIR.mkdir(parents=True, exist_ok=True)

with self.LOG_DIR as dir_path:
if not dir_path.exists():
dir_path.mkdir(parents=True, exist_ok=True)
if not self.LOG_DIR.exists():
self.LOG_DIR.mkdir(parents=True, exist_ok=True)

def __load_mode(self) -> None:
"""
Expand Down
6 changes: 4 additions & 2 deletions app/utils/http.py
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ class RequestUtils:
支持同步和异步请求
"""

__client = HTTPClient
__client: HTTPClient | None = None

@classmethod
def get_client(cls, *_, **__) -> HTTPClient:
Expand All @@ -348,7 +348,9 @@ def get_client(cls, *_, **__) -> HTTPClient:
:param url: 请求的 URL
:return: HTTP 客户端
"""
return cls.client
if cls.__client is None:
cls.__client = HTTPClient()
return cls.__client

@overload
@classmethod
Expand Down