refactor: lazy load credentials for testing
This commit is contained in:
@@ -25,6 +25,8 @@ from ..config import (
|
||||
TTL_NOT_FOUND,
|
||||
TTL_NETWORK_ERROR,
|
||||
MULTI_CANDIDATE_DELAY_S,
|
||||
QQ_MUSIC_API_LYRIC_ENDPOINT,
|
||||
QQ_MUSIC_API_SEARCH_ENDPOINT,
|
||||
)
|
||||
from ..authenticators import QQMusicAuthenticator
|
||||
|
||||
@@ -52,7 +54,7 @@ class QQMusicFetcher(BaseFetcher):
|
||||
try:
|
||||
async with httpx.AsyncClient(timeout=HTTP_TIMEOUT) as client:
|
||||
resp = await client.get(
|
||||
f"{await self.auth.authenticate()}/api/search",
|
||||
f"{await self.auth.authenticate()}{QQ_MUSIC_API_SEARCH_ENDPOINT}",
|
||||
params={"keyword": query, "type": "song", "num": limit},
|
||||
)
|
||||
resp.raise_for_status()
|
||||
@@ -111,7 +113,7 @@ class QQMusicFetcher(BaseFetcher):
|
||||
try:
|
||||
async with httpx.AsyncClient(timeout=HTTP_TIMEOUT) as client:
|
||||
resp = await client.get(
|
||||
f"{await self.auth.authenticate()}/api/lyric",
|
||||
f"{await self.auth.authenticate()}{QQ_MUSIC_API_LYRIC_ENDPOINT}",
|
||||
params={"mid": mid},
|
||||
)
|
||||
resp.raise_for_status()
|
||||
|
||||
Reference in New Issue
Block a user