|
|
|
|
|
|
|
from typing import Optional, Dict, Any |
|
|
|
|
|
from utils.storage import load_data |
|
from utils.config import FILE_PATHS |
|
from utils.logging import get_logger |
|
|
|
|
|
from utils.integrations.github import GitHubIntegration |
|
from utils.integrations.calendar import GoogleCalendarIntegration |
|
from utils.integrations.telegram import TelegramIntegration |
|
from utils.integrations.email import EmailIntegration |
|
from utils.integrations.rss import RSSIntegration |
|
from utils.integrations.weather import WeatherIntegration |
|
from utils.integrations.news import NewsIntegration |
|
from utils.integrations.crypto import CryptoIntegration |
|
|
|
|
|
logger = get_logger(__name__) |
|
|
|
|
|
def get_api_key(service_name: str) -> Optional[str]: |
|
"""Get API key for a specific service from settings |
|
|
|
Args: |
|
service_name: Name of the service |
|
|
|
Returns: |
|
API key if found, None otherwise |
|
""" |
|
try: |
|
|
|
settings = load_data(FILE_PATHS["settings"], {}) |
|
|
|
|
|
api_key = settings.get("api_keys", {}).get(service_name) |
|
|
|
if not api_key: |
|
logger.warning(f"No API key found for {service_name}") |
|
|
|
return api_key |
|
except Exception as e: |
|
logger.error(f"Error getting API key for {service_name}: {str(e)}") |
|
return None |
|
|
|
|
|
github_integration = GitHubIntegration() |
|
google_calendar_integration = GoogleCalendarIntegration() |
|
telegram_integration = TelegramIntegration() |
|
email_integration = EmailIntegration() |
|
rss_integration = RSSIntegration() |
|
weather_integration = WeatherIntegration() |
|
news_integration = NewsIntegration() |
|
crypto_integration = CryptoIntegration() |
|
|
|
|
|
__all__ = [ |
|
'github_integration', |
|
'google_calendar_integration', |
|
'telegram_integration', |
|
'email_integration', |
|
'rss_integration', |
|
'weather_integration', |
|
'news_integration', |
|
'crypto_integration', |
|
|
|
'GitHubIntegration', |
|
'GoogleCalendarIntegration', |
|
'TelegramIntegration', |
|
'EmailIntegration', |
|
'RSSIntegration', |
|
'WeatherIntegration', |
|
'NewsIntegration', |
|
'CryptoIntegration' |
|
] |