File size: 2,373 Bytes
8e4018d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
# Integrations package
# Import necessary modules
from typing import Optional, Dict, Any
# Import storage utilities
from utils.storage import load_data
from utils.config import FILE_PATHS
from utils.logging import get_logger
# Import all integration modules
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
# Initialize logger
logger = get_logger(__name__)
# Function to get API key from settings
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:
# Load settings
settings = load_data(FILE_PATHS["settings"], {})
# Get API key
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
# Create instances of each integration
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()
# Export all integration instances
__all__ = [
'github_integration',
'google_calendar_integration',
'telegram_integration',
'email_integration',
'rss_integration',
'weather_integration',
'news_integration',
'crypto_integration',
# Also export classes for direct import
'GitHubIntegration',
'GoogleCalendarIntegration',
'TelegramIntegration',
'EmailIntegration',
'RSSIntegration',
'WeatherIntegration',
'NewsIntegration',
'CryptoIntegration'
] |