Update app.py
Browse files
app.py
CHANGED
|
@@ -65,8 +65,8 @@ async def set_webhook():
|
|
| 65 |
# Construct the webhook URL using the SPACE_ID environment variable
|
| 66 |
webhook_url = f"https://dynstat-test2.hf.space/webhook"
|
| 67 |
# Telegram API URL to set the webhook
|
| 68 |
-
|
| 69 |
-
set_webhook_url = f"https://149.154.167.220/bot{TELEGRAM_BOT_TOKEN}/setWebhook"
|
| 70 |
# Payload containing the webhook URL and the secret token for security
|
| 71 |
payload = {
|
| 72 |
"url": webhook_url,
|
|
@@ -83,7 +83,7 @@ async def set_webhook():
|
|
| 83 |
async def test_conn():
|
| 84 |
try:
|
| 85 |
async with aiohttp.ClientSession(timeout=aiohttp.ClientTimeout(total=10)) as session:
|
| 86 |
-
async with session.get("https://
|
| 87 |
return {"status": "success", "telegram_api_status": response.status}
|
| 88 |
except Exception as e:
|
| 89 |
logger.error(f"Connection test failed: {str(e)}", exc_info=True)
|
|
|
|
| 65 |
# Construct the webhook URL using the SPACE_ID environment variable
|
| 66 |
webhook_url = f"https://dynstat-test2.hf.space/webhook"
|
| 67 |
# Telegram API URL to set the webhook
|
| 68 |
+
set_webhook_url = f"https://api.telegram.org/bot{TELEGRAM_BOT_TOKEN}/setWebhook"
|
| 69 |
+
# set_webhook_url = f"https://149.154.167.220/bot{TELEGRAM_BOT_TOKEN}/setWebhook"
|
| 70 |
# Payload containing the webhook URL and the secret token for security
|
| 71 |
payload = {
|
| 72 |
"url": webhook_url,
|
|
|
|
| 83 |
async def test_conn():
|
| 84 |
try:
|
| 85 |
async with aiohttp.ClientSession(timeout=aiohttp.ClientTimeout(total=10)) as session:
|
| 86 |
+
async with session.get("https://api.telegram.org") as response:
|
| 87 |
return {"status": "success", "telegram_api_status": response.status}
|
| 88 |
except Exception as e:
|
| 89 |
logger.error(f"Connection test failed: {str(e)}", exc_info=True)
|