修正token不配置的问题

This commit is contained in:
X-T-E-R
2024-09-04 19:36:56 +08:00
parent c2eb7ba586
commit afba95227f
2 changed files with 4 additions and 1 deletions
+2
View File
@@ -82,6 +82,8 @@ def download_file_with_requests(url, full_path):
from urllib.parse import urlparse, parse_qs, urlencode, urlunparse
def add_token_to_url(url: str, token: str) -> str:
# 在URL中添加或更新token参数
if token is None or len(token) == 0:
return url
parsed_url = urlparse(url)
query_params = parse_qs(parsed_url.query)
query_params['token'] = token
+2 -1
View File
@@ -13,9 +13,10 @@ settings = Dynaconf(
)
# print(settings)
class CivitaiConfig:
api_endpoint: str = settings.civitai.api_endpoint
token: str = settings.civitai.token
token: str = settings.civitai.get("token", "")
json_cache_dir: pathlib.Path = pathlib.Path(__file__).parent.parent / "json_cache"
aria2_extra_args: list[str] = settings.aria2.extra_args or []
max_retry: int = settings.aria2.max_retry or 5