Как сделать проверку на ссылку в боте?
Сделал такой код
if message.text.lower() == 'https://mail.ru':
TEXT = '''https://mail.ru qwe http://google.com ? http://yandex.ru'''
urls = 'http[s]?://(?:[a-zA-Z]|[0-9]|[$-_@.&+]|[!*\(\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+'
result = [url for url in findall(urls, TEXT) if url.rstrip().endswith('check?uri=')]
bot.send_message(message.chat.id, result, reply_markup=keyboard4)
Выдает ошибки:
2020-02-11 02:06:08,786 (util.py:66 WorkerThread2) ERROR - TeleBot: "ApiException occurred, args=('A request to the Telegram API was unsuccessful. The server returned HTTP 400 Bad Request. Response body:\n[b\'{"ok":false,"error_code":400,"description":"Bad Request: message text is empty"}\']',)
Traceback (most recent call last):
File "C:\Users\Na\PycharmProjects\bot\venv\lib\site-packages\telebot\util.py", line 60, in run
task(*args, **kwargs)
File "C:/Users/Na/PycharmProjects/untitled2/bot1", line 63, in send_text
bot.send_message(message.chat.id, result, reply_markup=keyboard4)
File "C:\Users\Na\PycharmProjects\bot\venv\lib\site-packages\telebot\__init__.py", line 600, in send_message
apihelper.send_message(self.token, chat_id, text, disable_web_page_preview, reply_to_message_id,
File "C:\Users\Na\PycharmProjects\bot\venv\lib\site-packages\telebot\apihelper.py", line 154, in send_message
return _make_request(token, method_url, params=payload, method='post')
File "C:\Users\Na\PycharmProjects\bot\venv\lib\site-packages\telebot\apihelper.py", line 60, in _make_request
return _check_result(method_name, result)['result']
File "C:\Users\Na\PycharmProjects\bot\venv\lib\site-packages\telebot\apihelper.py", line 79, in _check_result
raise ApiException(msg, method_name, result)
telebot.apihelper.ApiException: A request to the Telegram API was unsuccessful. The server returned HTTP 400 Bad Request. Response body:
[b'{"ok":false,"error_code":400,"description":"Bad Request: message text is empty"}']
"
2020-02-11 02:06:08,787 (__init__.py:420 MainThread) ERROR - TeleBot: "A request to the Telegram API was unsuccessful. The server returned HTTP 400 Bad Request. Response body:
[b'{"ok":false,"error_code":400,"description":"Bad Request: message text is empty"}']"