def __init__(self, username, password, captcha_handler=None): self.api = vkapi.vk_api(username, password, 4) self.api.captcha_handler = captcha_handler self.api.getToken() self.banned_messages = set() self.guid = int(time.time() * 5) self.ensureLoggedIn() self.self_id = str(self.api.users.get()[0]['id']) self.last_viewed_comment = 0 self.name_cache = {}
def __init__(self, username='', password=''): self.api = vkapi.vk_api(username, password, ignored_errors=ignored_errors) self.api.initLongpoll() self.users = user_cache(self.api, 'sex,crop_photo,blacklisted,blacklisted_by_me') self.initSelf() self.guid = int(time.time() * 5) self.last_viewed_comment = 0 self.good_conf = {} self.tm = thread_manager() self.last_message = {} # peer_id: (id, time, text) self.last_message_id = 0 self.whitelist = None self.bad_conf_title = lambda s: False self.admin = None
def __init__(self, username='', password=''): self.api = vkapi.vk_api(username, password, ignored_errors=ignored_errors) self.api.initLongpoll() self.users = user_cache( self.api, 'sex,crop_photo,blacklisted,blacklisted_by_me') self.initSelf() self.guid = int(time.time() * 5) self.last_viewed_comment = 0 self.good_conf = {} self.tm = thread_manager() self.last_message = {} # peer_id: (id, time, text) self.last_message_id = 0 self.whitelist = None self.bad_conf_title = lambda s: False self.admin = None
sys.stdout = codecs.getwriter("utf-8")(sys.stdout.detach()) login = config.get('login.login') password = config.get('login.password') if args['script']: if not args['script'].replace('_', '').isalpha(): print('Invalid script') sys.exit() log.script_name = args['script'].lower() try: main = importlib.import_module('scripts.' + args['script'].lower()).main except ImportError: print('Invalid script') sys.exit() v = vk_api(login, password) main(v, args['args']) v.sync() sys.exit() pid_file = accounts.getFile('inf.pid') lock_file = accounts.getFile('inf.lock') fp = open(lock_file, 'w') single = False for i in range(100): try: fcntl.lockf(fp, fcntl.LOCK_EX | fcntl.LOCK_NB) except IOError: time.sleep(5) else: single = True
os.environ['LC_ALL'] = 'ru_RU.utf-8' sys.stdout = codecs.getwriter("utf-8")(sys.stdout.detach()) login = config.get('login.login') password = config.get('login.password') if args['script']: if not args['script'].replace('_', '').isalpha(): print('Invalid script') sys.exit() log.script_name = args['script'].lower() try: main = importlib.import_module('scripts.' + args['script'].lower()).main except ImportError: print('Invalid script') sys.exit() v = vk_api(login, password) main(v, args['args']) v.sync() sys.exit() pid_file = accounts.getFile('inf.pid') lock_file = accounts.getFile('inf.lock') fp = open(lock_file, 'w') single = False for i in range(100): try: fcntl.lockf(fp, fcntl.LOCK_EX | fcntl.LOCK_NB) except IOError: time.sleep(5) else: single = True