#!/usr/bin/env python3 """Manually trigger login using the reusable iklim.co client.""" from __future__ import annotations import logging import sys from pathlib import Path from typing import Any import requests from common import ApiError, ConfigurationError, IklimClient, configure_logging BASE_DIR = Path(__file__).resolve().parent def login() -> dict[str, Any]: client = IklimClient.from_env(BASE_DIR / ".env") return client.auth.login() def main() -> int: configure_logging(BASE_DIR / "logs" / "iklim-api-debug.log") try: login() except (ConfigurationError, ApiError, requests.RequestException) as exc: logging.error("Login başarısız: %s", exc) return 1 return 0 if __name__ == "__main__": sys.exit(main())