fix: add proxy support to httpx to allow Telegram API requests
Deploy Dashboard / deploy (push) Successful in 3m24s
Deploy Dashboard / deploy (push) Successful in 3m24s
This commit is contained in:
@@ -16,7 +16,8 @@ async def send_notification(body: dict):
|
||||
msg = body.get("message", "")
|
||||
if not msg or not TELEGRAM_BOT_TOKEN or not TELEGRAM_CHAT_ID:
|
||||
return {"ok": False, "error": "missing message or Telegram config"}
|
||||
async with httpx.AsyncClient() as client:
|
||||
proxy_url = os.environ.get("HTTP_PROXY") or os.environ.get("http_proxy")
|
||||
async with httpx.AsyncClient(proxy=proxy_url) as client:
|
||||
r = await client.post(
|
||||
f"https://api.telegram.org/bot{TELEGRAM_BOT_TOKEN}/sendMessage",
|
||||
data={"chat_id": TELEGRAM_CHAT_ID, "text": msg, "parse_mode": "Markdown"},
|
||||
|
||||
Reference in New Issue
Block a user