"""Wysyła testowego emaila przez SendGrid na d@dgx.dev."""

from sendgrid import SendGridAPIClient
from sendgrid.helpers.mail import Mail

from scraper import config


def main() -> None:
    message = Mail(
        from_email=config.SENDGRID_FROM,
        to_emails="d@dgx.dev",
        subject="Test scraper-prawny",
        plain_text_content="To jest testowy email z scraper-prawny.klono.ai",
    )
    try:
        client = SendGridAPIClient(config.SENDGRID_API_KEY)
        resp = client.send(message)
        print(f"SUKCES — status {resp.status_code}")
    except Exception as e:
        print(f"BŁĄD — {type(e).__name__}: {e}")


if __name__ == "__main__":
    main()
