From 765bcab97d7ccdcaf987074f9496885240aa9c4c Mon Sep 17 00:00:00 2001 From: Artur Galyamov Date: Wed, 21 Dec 2022 08:50:17 +0500 Subject: [PATCH] =?UTF-8?q?=D0=9A=D0=BE=D1=80=D1=80=D0=B5=D0=BA=D1=82?= =?UTF-8?q?=D0=BD=D0=BE=20=D0=BF=D0=BE=D1=81=D1=8B=D0=BB=D0=B0=D0=B5=D0=BC?= =?UTF-8?q?=20=D0=B2=20=D1=82=D0=B5=D0=BB=D0=B5=D0=B3=D1=80=D0=B0=D0=BC=20?= =?UTF-8?q?=D1=82=D0=B5=D0=BA=D1=81=D1=82=20=D0=B2=20=D1=82.=D1=87.=20?= =?UTF-8?q?=D1=81=20=D0=BD=D0=B5=D1=87=D0=B8=D1=82=D0=B0=D0=B5=D0=BC=D1=8B?= =?UTF-8?q?=D0=BC=D0=B8=20=D1=81=D0=B8=D0=BC=D0=B2=D0=BE=D0=BB=D0=B0=D0=BC?= =?UTF-8?q?=D0=B8=20#11?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit например, # --- cms/promoters.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cms/promoters.py b/cms/promoters.py index 6fed4dd..f94d880 100644 --- a/cms/promoters.py +++ b/cms/promoters.py @@ -1,5 +1,6 @@ import abc import os +from urllib.parse import urlencode import requests @@ -24,8 +25,10 @@ class TelegramPromoter(Promoter): channel_id = os.getenv('TELEGRAM_CHAT_ID') long_text = f'{self.article.body}\n{self.article.link}' + querystring = (('chat_id', channel_id), ('text', long_text)) + encoded_querystring = urlencode(querystring) - send_message_url = f'https://api.telegram.org/bot{bot_token}/sendMessage?chat_id={channel_id}&text={long_text}' + send_message_url = f'https://api.telegram.org/bot{bot_token}/sendMessage?{encoded_querystring}' response = requests.get(send_message_url) result = response.json()