Skip to content

Commit ec6b1ff

Browse files
committed
chore: 设置正确的 UA
1 parent 740a926 commit ec6b1ff

File tree

3 files changed

+5
-6
lines changed

3 files changed

+5
-6
lines changed

src/kmdr/core/defaults.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@
1616
from .utils import singleton
1717
from .structure import Config
1818

19+
HEADERS = {
20+
'User-Agent': 'kmdr/1.0 (https://github.com/chrisis58/kmoe-manga-downloader)'
21+
}
1922

2023
console = Console()
2124

src/kmdr/core/session.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from aiohttp import ClientSession
44

55
from .bases import KMDR_SESSION
6-
from .defaults import session_var
6+
from .defaults import session_var, HEADERS
77

88
@KMDR_SESSION.register()
99
class KmdrSession(ClientSession):
@@ -12,5 +12,5 @@ class KmdrSession(ClientSession):
1212
"""
1313

1414
def __init__(self, proxy: Optional[str] = None, *args, **kwargs):
15-
ClientSession.__init__(self, proxy=proxy, trust_env=True)
15+
ClientSession.__init__(self, proxy=proxy, trust_env=True, headers=HEADERS)
1616
session_var.set(self)

src/kmdr/core/utils.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,6 @@
1010
from .structure import BookInfo, VolInfo
1111

1212

13-
HEADERS = {
14-
'User-Agent': 'kmdr/1.0 (https://github.com/chrisis58/kmoe-manga-downloader)'
15-
}
16-
1713
def singleton(cls):
1814
"""
1915
**非线程安全**的单例装饰器

0 commit comments

Comments
 (0)