mirror of
https://github.com/marcogll/telegram_expenses_controller.git
synced 2026-01-13 21:35:15 +00:00
feat: Implement core application structure, AI extraction, persistence, and Telegram bot modules with updated configuration and dependencies.
This commit is contained in:
21
app/integrations/webhook_client.py
Normal file
21
app/integrations/webhook_client.py
Normal file
@@ -0,0 +1,21 @@
|
||||
"""
|
||||
Client for sending data to external webhook URLs.
|
||||
"""
|
||||
import httpx
|
||||
import logging
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
async def send_to_webhook(url: str, data: dict):
|
||||
"""
|
||||
Sends a POST request with JSON data to a specified webhook URL.
|
||||
"""
|
||||
try:
|
||||
async with httpx.AsyncClient() as client:
|
||||
response = await client.post(url, json=data)
|
||||
response.raise_for_status()
|
||||
logger.info(f"Successfully sent data to webhook {url}")
|
||||
return True
|
||||
except httpx.RequestError as e:
|
||||
logger.error(f"Failed to send data to webhook {url}: {e}")
|
||||
return False
|
||||
Reference in New Issue
Block a user