Answer the question
In order to leave comments, you need to log in
What caused the error when getting data from a SQLite database?
I am writing a bot. I wrote a code that retrieves data from the database and the bot displays them in the cart. But it all ends with the fact that when I click on the button in the bot, which should display the information from the database, a spam of an incomprehensible error appears in the console. What causes it and how to avoid it?
2020-07-19 18:31:36,338 (__init__.py:455 MainThread) ERROR - TeleBot: "A request to the Telegram API was unsuccessful. The server returned HTTP 414 Request-URI Too Large. Response body:
[b'<html>\r\n<head><title>414 Request-URI Too Large</title></head>\r\n<body>\r\n<center><h1>414 Request-URI Too Large</h1></center>\r\n<hr><center>nginx/1.16.1</center>\r\n</body>\r\n</html>\r\n']"
def product(name ):
with sqlite3.connect('database.db') as connection:
cursor = connection.cursor()
cursor.execute("SELECT * FROM catalog WHERE name = ? ", (name,))
result = cursor.fetchone()
return result
if call.data == 'bud-1':
markup = types.InlineKeyboardMarkup(row_width=1)
item1 = types.InlineKeyboardButton("Назад", callback_data='bud')
markup.add(item1)
bot.edit_message_text(chat_id=call.message.chat.id, message_id=call.message.message_id, text=product('bud1'), parse_mode='html', reply_markup=markup)
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question