def hello(): global chat TOKEN = "303253879:AAGlGdiEJhIO933iVpJg2-tiRJwhpqC4o6g" requests.get('https://api.telegram.org/bot%s/sendMessage?chat_id=%s&text=ok' % (TOKEN, chat.chat_id)) print(request.json) msg = Message(request.json) chat = Chat(msg.chat_id) if msg.chat_id in UNVERIFIED_USERS: login = msg.text try: user = User.get(login) user.chat_id = chat.chat_id user.update() UNVERIFIED_USERS.remove(msg.chat_id) chat.sendmessage("Вы добавлены в рассылку!") except: chat.sendmessage("No such user!!") msg.text = '/start' if msg.text == '/start': chat.sendmessage("Введите Ваш логин:") UNVERIFIED_USERS.append(msg.chat_id) elif msg.text == 'VK': text = "Parser result for VK" login = ChatInfo.getlogin(msg.chat_id) user = User.get(login) subs = user.subscriptions if subs is not None: chat.sendmessage(str(subs)) else: chat.sendmessage("Ваши подписки") json_keyboard = json.dumps({'keyboard': [["VK"], ["Instagram"]], 'one_time_keyboard': False, 'resize_keyboard': True}) bot.getKeyboard(msg.chat_id, text, json_keyboard) elif msg.text == 'Instagram': text = "Parser result for Instagram" json_keyboard = json.dumps({'keyboard': [["VK"], ["Instagram"]], 'one_time_keyboard': False, 'resize_keyboard': True}) bot.getKeyboard(msg.chat_id, text, json_keyboard) else: json_keyboard = json.dumps({'keyboard': [["VK"], ["Instagram"]], 'one_time_keyboard': False, 'resize_keyboard': True}) bot.getKeyboard(msg.chat_id, "Choose source!", json_keyboard) print(request.json)