e
This commit is contained in:
parent
1257f84f58
commit
00000d940e
6 changed files with 29 additions and 48 deletions
|
|
@ -1,11 +1,10 @@
|
|||
import json
|
||||
import re
|
||||
from datetime import datetime
|
||||
from pathlib import Path
|
||||
|
||||
import httpx
|
||||
|
||||
from .utils import LOGOS, TZ, get_logger
|
||||
from .utils import LOGOS, get_logger, now
|
||||
|
||||
log = get_logger(__name__)
|
||||
|
||||
|
|
@ -19,7 +18,7 @@ CACHE_FILE = Path(__file__).parent / "caches" / "tvpass.json"
|
|||
def load_cache() -> dict[str, str]:
|
||||
try:
|
||||
data = json.loads(CACHE_FILE.read_text(encoding="utf-8"))
|
||||
return {} if 8 <= datetime.now(TZ).hour <= 12 else data
|
||||
return {} if 8 <= now.hour <= 12 else data
|
||||
except (FileNotFoundError, json.JSONDecodeError):
|
||||
return {}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue