Вынесен импорт fromstring из fetch_rss на уровень модуля

This commit is contained in:
deadzilla 2026-07-14 22:15:14 +05:00
parent d4b457f94e
commit 66b16e95f4

View File

@ -4,6 +4,7 @@ import re
from datetime import datetime
from typing import Optional
from defusedxml.ElementTree import fromstring
import requests
from utils.rate_limiter import habr_rss_limiter
@ -23,7 +24,6 @@ _session = requests.Session()
async def fetch_rss(url: str) -> Optional[list[dict]]:
"""Скачать и распарсить RSS-ленту (RSS 2.0 / Atom)."""
await habr_rss_limiter.acquire()
from defusedxml.ElementTree import fromstring
try:
response = await asyncio.to_thread(_session.get, url, timeout=10)