From a55301131ce7fcfbedb797e029ebc37b1781bdfa Mon Sep 17 00:00:00 2001 From: Anton Date: Sat, 6 May 2023 00:52:08 +0300 Subject: [PATCH] =?UTF-8?q?=D0=A0=D0=B5=D0=B0=D0=BB=D0=B8=D0=B7=D0=BE?= =?UTF-8?q?=D0=B2=D0=B0=D0=BB=20=D0=B4=D0=BE=D1=81=D1=82=D1=83=D0=BF=20?= =?UTF-8?q?=D0=BA=20=D0=92=D0=9A=20=D0=BF=D0=BE=20=D0=BE=D0=BF=D0=BE=D0=B7?= =?UTF-8?q?=D0=BD=D0=B0=D0=BA=D1=83=20(token)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cms/promoters.py | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/cms/promoters.py b/cms/promoters.py index 6baf74a..dbdccd5 100644 --- a/cms/promoters.py +++ b/cms/promoters.py @@ -37,21 +37,22 @@ class TelegramPromoter(Promoter): class VkontaktePromoter(Promoter): def promote(self): - vk_login = promoter_secrets['VK_LOGIN'] - vk_password = promoter_secrets['VK_PASSWORD'] vk_owner_id = promoter_secrets['VK_OWNER_ID'] - - import vk_api - session = vk_api.VkApi(login=vk_login, - password=vk_password) - session.auth() - api = session.get_api() + vk_token = promoter_secrets['VK_TOKEN'] + from_group = 1 try: - api.wall.post(owner_id=vk_owner_id, - message=self.article.body, - attachments=self.article.link) - except vk_api.VkApiError as exc: + requests.post('https://api.vk.com/method/wall.post', + params={ + 'access_token': vk_token, + 'owner_id': vk_owner_id, + 'from_group': from_group, + 'message': self.article.body, + 'attachment': self.article.link, + 'signed': 0, + 'v': '5.131' + }) + except Exception as exc: raise PromoteError(exc)