import requests # Define endpoints for demonstration API_ENDPOINTS = { "weather": "https://api.open-meteo.com/v1/forecast?latitude=52.52&longitude=13.41¤t_weather=true", "news": "https://newsapi.org/v2/top-headlines?country=us&apiKey=YOUR_NEWS_API_KEY", "stocks": "https://finnhub.io/api/v1/quote?symbol=AAPL&token=YOUR_STOCK_API_KEY" } def get_weather(): try: response = requests.get(API_ENDPOINTS["weather"]) return response.json() except Exception as e: return {"error": str(e)} def get_news(): try: response = requests.get(API_ENDPOINTS["news"]) return response.json() except Exception as e: return {"error": str(e)} def get_stock(): try: response = requests.get(API_ENDPOINTS["stocks"]) return response.json() except Exception as e: return {"error": str(e)} if __name__ == "__main__": print("🌦️ Weather:", get_weather()) print("🗞️ News:", get_news()) print("📈 Stock:", get_stock())