From 3a967957760a33764b76171563cd48a4ab079637 Mon Sep 17 00:00:00 2001 From: Himura Kazuto Date: Thu, 16 Sep 2021 21:13:11 +0300 Subject: [PATCH] Move inviter to a separate dir --- {etc => vk-inviter}/vk_inviter.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) rename {etc => vk-inviter}/vk_inviter.py (95%) diff --git a/etc/vk_inviter.py b/vk-inviter/vk_inviter.py similarity index 95% rename from etc/vk_inviter.py rename to vk-inviter/vk_inviter.py index 081be85..5b8f2c0 100644 --- a/etc/vk_inviter.py +++ b/vk-inviter/vk_inviter.py @@ -1,4 +1,5 @@ #!/usr/bin/env python3 +# -*- coding: utf-8 -*- # Author: Himura Kazuto from time import sleep @@ -54,8 +55,8 @@ def __dump(self, captcha): def __invite_member(self, i, user, target_group, retry_count=0, captcha=None): user_id, user_info = user print(f'[ {i}/{len(self.members_to_invite) - 1} | {user_info["first_name"]} {user_info["last_name"]} ]', end=' ', flush=True) - if retry_count > 3: - print(f'Too many retries ({retry_count}), giving up') + if retry_count > 4: + print(f'Слишком много попыток ({retry_count}), забиваем и идём дальше...') return False try: try: @@ -67,7 +68,7 @@ def __invite_member(self, i, user, target_group, retry_count=0, captcha=None): if captcha: self.__dump(captcha) if invite_response == 1: - print(f'Invited to "{target_group["name"]}"') + print(f'Приглашён в "{target_group["name"]}"') else: print(invite_response) except vk.exceptions.VkAPIError as e: @@ -75,7 +76,7 @@ def __invite_member(self, i, user, target_group, retry_count=0, captcha=None): self.__dump(captcha) raise e except vk.exceptions.VkAPIError as e: - print(f'{e.message} (code {e.code})') + print(f'{e.message} (ошибка {e.code})') if e.code == e.CAPTCHA_NEEDED: with urlopen(e.captcha_img) as f: img_bytes = f.read()