from __future__ import annotations import httpx from email_campaigns.adapters.google.models import WebfontList from email_campaigns.config import Settings class GoogleFontsClient: def __init__(self, settings: Settings) -> None: self.api_key = settings.google_fonts_api_key def get_webfonts(self) -> WebfontList: with httpx.Client(timeout=10.0) as client: response = client.get( "https://www.googleapis.com/webfonts/v1/webfonts", params={"key": self.api_key, "sort": "popularity"}, ) response.raise_for_status() return WebfontList.model_validate(response.json())