Files
Bram e2cfcfad34
Build and Push Docker Images / build-and-push (push) Successful in 5m25s
lightweight meta tags
2025-06-05 14:05:38 +02:00

15 lines
570 B
Python

from aiohttp import ClientSession, ClientTimeout
from app.config import CUSTOM_USER_AGENT
async def fetch_url(url: str) -> tuple[str, int]:
"""
Fetch a URL using aiohttp and return the content and status code
"""
timeout = ClientTimeout(total=30) # 30 second timeout
async with ClientSession(timeout=timeout) as session:
headers = {
'User-Agent': CUSTOM_USER_AGENT
}
async with session.get(url, headers=headers) as response:
content = await response.text()
return content, response.status