Files
iklim-sandbox/login.py
T
2026-09-09 16:21:13 +03:00

36 lines
780 B
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/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())