from typing import Dict
import httpx
from src.config import settings
from src.schemas import CurrencyPrice
async def make_coin_gecko_request(url: str) -> Dict[str, CurrencyPrice] | None:
"""Make a request to the Coin Gecko API with proper error handling."""
headers = {"User-Agent": settings.USER_AGENT, "Accept": "application/json"}
async with httpx.AsyncClient() as client:
try:
response = await client.get(url, headers=headers, timeout=30.0)
response.raise_for_status()
return response.json()
except Exception:
return None