caronc / apprise

Apprise - Push Notifications that work with just about every platform!
https://hub.docker.com/r/caronc/apprise
BSD 2-Clause "Simplified" License
11.7k stars 410 forks source link

Notify telegram with attachment size over 5 MB fails #1213

Open LeRisto opened 1 day ago

LeRisto commented 1 day ago

:mega: Notification Service(s) Impacted Telegram

:lady_beetle: Describe the bug Sending multiple attachments with a combined size of greater than 5 MB it will be rejected by the telegram API

:bulb: Screenshots and Logs image This will fail, because its over 5 MB: apprise -vvvv --title "test" --body "TEST" --attach IMG_1695.pdf --attach IMG_1697.pdf tgram://<foobar>

2024-10-01 19:52:29,128 - DEBUG - Loaded Telegram URL: tgram://8...M/?image=False&detect=no&silent=no&preview=no&content=before&mdv=v1&format=html&overflow=upstream 2024-10-01 19:52:29,129 - DEBUG - Loading attachment: IMG_1695.pdf 2024-10-01 19:52:29,130 - TRACE - Attachment Plugin file loaded in 0.000000s 2024-10-01 19:52:29,131 - TRACE - Attachment Plugin http loaded in 0.001000s 2024-10-01 19:52:29,131 - TRACE - Attachment Plugin memory loaded in 0.000000s 2024-10-01 19:52:29,132 - DEBUG - Attachment Plugin 3(s) and 4 Schema(s) loaded in 0.0020s 2024-10-01 19:52:29,186 - DEBUG - Loading attachment: IMG_1697.pdf 2024-10-01 19:52:29,187 - DEBUG - Telegram POST URL: https://api.telegram.org/bot/sendMessage (cert_verify=True) 2024-10-01 19:52:29,187 - DEBUG - Telegram Payload: {'disable_notification': False, 'disable_web_page_preview': True, 'parse_mode': 'HTML', 'text': 'test\r\nTEST', 'chat_id': ...} 2024-10-01 19:52:29,474 - INFO - Sent Telegram notification. 2024-10-01 19:52:29,475 - DEBUG - Posting Telegram attachment file://IMG_1695.pdf 2024-10-01 19:52:29,476 - DEBUG - Telegram attachment POST URL: https://api.telegram.org/bot/sendDocument (cert_verify=True) 2024-10-01 19:52:36,523 - WARNING - A connection error occurred posting Telegram attachment. 2024-10-01 19:52:36,523 - DEBUG - Socket Exception: HTTPSConnectionPool(host='api.telegram.org', port=443): Read timed out. (read timeout=4.0)

:computer: Your System Details:

:crystal_ball: Additional context The Telegram API specifies greater file limits, what's going on?

caronc commented 19 hours ago

I'm not sure if this is a bug with Apprise or a limitation with Telegram. What is your expectation of how Apprise should handle this?

LeRisto commented 1 hour ago

I'm not sure if this is a bug with Apprise or a limitation with Telegram. What is your expectation of how Apprise should handle this?

From the Telegram API docs: image

Looking at the telegram plugin code i assume (i'm not into python that deep) the third option with POST is used and therefor should easily handle two PDF with 5.2MB total size. Is my assumption wrong?