from flask import Flask, request, json from core import EventManager from utilits import settings app = Flask(__name__) manager = EventManager() manager.initialization_handlers() @app.route('/handler/vk') def handler_vk(): # Обработчик запросов от вк try: data = json.loads(request.get_data()) except: return "Data error", 200 vk_settings = settings('vk') if data['type'] == 'confirmation': return vk_settings['code'] if data['secret'] != vk_settings['secret'] or int( data['group_id']) not in vk_settings['groups']: return "Verification error", 200 manager.new_event(data) return "Ok", 200 if __name__ == '__main__': app.run()
from core import EventManager EventManager().initialization_handlers()