|
|
Регистрация Восстановить пароль |
Повторная активизация e-mail |
Регистрация | Задать вопрос |
Заплачу за решение |
Новые сообщения |
Сообщения за день |
Расширенный поиск |
Правила |
Всё прочитано |
|
Опции темы | Поиск в этой теме |
05.05.2019, 16:42 | #1 |
Новичок
Джуниор
Регистрация: 05.05.2019
Сообщений: 4
|
Помогите с ботом для Telegram
Первый раз пишу что то более менее осознанное, поэтому со многим сталкиваюсь впервые.
Вот сам код: import telebot TOKEN = "868629624:AAFnTMV0oK3FmH7_yYFPLUEa Y4LvFD2TIIY" bot = telebot.TeleBot(TOKEN) @bot.message_handler(commands=['start']) def start(message): sent = bot.send_message(message.chat.id, 'Как тебя зовут?') bot.register_next_step_handler(sent , hello) def hello(message): bot.send_message(message.chat.id, 'Привет, {name}. Рад тебя видеть.'.format(name=message.text)) bot.polling() Вот ошибка: C:\Users\Артём\Desktop\PyCode>pytho n bot.py 2019-05-05 16:19:30,404 (util.py:66 PollingThread) ERROR - TeleBot: "SSLError oc curred, args=(MaxRetryError('HTTPSConnectio nPool(host=\'api.telegram.org\', port =443): Max retries exceeded with url: /bot868629624:AAFnTMV0oK3FmH7_yYFPLU EaY4Lv FD2TIIY/getUpdates?offset=1&timeout=20 (Caused by SSLError(SSLError("bad handsha ke: Error([(\'SSL routines\', \'tls_process_server_certificate\', \'certificate verify failed\')])")))'),) Traceback (most recent call last): File "C:\Users\Артём\AppData\Local\Progr ams\Python\Python37-32\lib\site-packag es\urllib3-1.24.3-py3.7.egg\urllib3\contrib\pyopenssl .py", line 456, in wrap_soc ket cnx.do_handshake() File "C:\Users\Артём\AppData\Local\Progr ams\Python\Python37-32\lib\site-packag es\OpenSSL\SSL.py", line 1915, in do_handshake self._raise_ssl_error(self._ssl, result) File "C:\Users\Артём\AppData\Local\Progr ams\Python\Python37-32\lib\site-packag es\OpenSSL\SSL.py", line 1647, in _raise_ssl_error _raise_current_error() File "C:\Users\Артём\AppData\Local\Progr ams\Python\Python37-32\lib\site-packag es\OpenSSL\_util.py", line 54, in exception_from_error_queue raise exception_type(errors) OpenSSL.SSL.Error: [('SSL routines', 'tls_process_server_certificate', 'certific ate verify failed')] During handling of the above exception, another exception occurred: raise ssl.SSLError('bad handshake: %r' % e) ssl.SSLError: ("bad handshake: Error([('SSL routines', 'tls_process_server_certi ficate', 'certificate verify failed')])",) During handling of the above exception, another exception occurred: Traceback (most recent call last): File "C:\Users\Артём\AppData\Local\Progr ams\Python\Python37-32\lib\site-packag During handling of the above exception, another exception occurred: Traceback (most recent call last): File "C:\Users\Артём\AppData\Local\Progr ams\Python\Python37-32\lib\site-packag es\pytelegrambotapi-3.6.6-py3.7.egg\telebot\util.py", line 60, in run task(*args, **kwargs) File "C:\Users\Артём\AppData\Local\Progr ams\Python\Python37-32\lib\site-packag es\pytelegrambotapi-3.6.6-py3.7.egg\telebot\__init__.py", line 277, in __retriev e_updates updates = self.get_updates(offset=(self.last_ update_id + 1), timeout=timeout ) File "C:\Users\Артём\AppData\Local\Progr ams\Python\Python37-32\lib\site-packag es\pytelegrambotapi-3.6.6-py3.7.egg\telebot\__init__.py", line 247, in get_updat es json_updates = apihelper.get_updates(self.token, offset, limit, timeout, all owed_updates) Traceback (most recent call last): File "C:\Users\Артём\AppData\Local\Progr ams\Python\Python37-32\lib\site-packag es\urllib3-1.24.3-py3.7.egg\urllib3\contrib\pyopenssl .py", line 456, in wrap_soc ket cnx.do_handshake() File "C:\Users\Артём\AppData\Local\Progr ams\Python\Python37-32\lib\site-packag es\OpenSSL\SSL.py", line 1915, in do_handshake self._raise_ssl_error(self._ssl, result) File "C:\Users\Артём\AppData\Local\Progr ams\Python\Python37-32\lib\site-packag es\OpenSSL\SSL.py", line 1647, in _raise_ssl_error st self._validate_conn(conn) File "C:\Users\Артём\AppData\Local\Progr ams\Python\Python37-32\lib\site-packag es\urllib3-1.24.3-py3.7.egg\urllib3\connectionpool.py ", line 839, in _validate_c onn conn.connect() File "C:\Users\Артём\AppData\Local\Progr ams\Python\Python37-32\lib\site-packag es\urllib3-1.24.3-py3.7.egg\urllib3\connection.py", line 344, in connect ssl_context=context) File "C:\Users\Артём\AppData\Local\Progr ams\Python\Python37-32\lib\site-packag es\urllib3-1.24.3-py3.7.egg\urllib3\util\ssl_.py", line 345, in ssl_wrap_socket return context.wrap_socket(sock, server_hostname=server_hostname) File "C:\Users\Артём\AppData\Local\Progr ams\Python\Python37-32\lib\site-packag es\urllib3-1.24.3-py3.7.egg\urllib3\contrib\pyopenssl .py", line 462, in wrap_soc ket raise ssl.SSLError('bad handshake: %r' % e) ssl.SSLError: ("bad handshake: Error([('SSL routines', 'tls_process_server_certi ficate', 'certificate verify failed')])",) During handling of the above exception, another exception occurred: Traceback (most recent call last): File "C:\Users\Артём\AppData\Local\Progr ams\Python\Python37-32\lib\site-packag es\requests\adapters.py", line 449, in send timeout=timeout File "C:\Users\Артём\AppData\Local\Progr ams\Python\Python37-32\lib\site-packag es\urllib3-1.24.3-py3.7.egg\urllib3\connectionpool.py ", line 638, in urlopen _stacktrace=sys.exc_info()[2]) File "C:\Users\Артём\AppData\Local\Progr ams\Python\Python37-32\lib\site-packag es\urllib3-1.24.3-py3.7.egg\urllib3\util\retry.py", line 399, in increment raise MaxRetryError(_pool, url, error or ResponseError(cause)) urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='api.teleg ram.org', p ort=443): Max retries exceeded with url: /bot868629624:AAFnTMV0oK3FmH7_yYFPLU EaY 4LvFD2TIIY/getUpdates?offset=1&timeout=20 (Caused by SSLError(SSLError("bad hand shake: Error([('SSL routines', 'tls_process_server_certificate', 'certificate ve rify failed')])"))) During handling of the above exception, another exception occurred: Traceback (most recent call last): File "bot.py", line 15, in <module> bot.polling() File "C:\Users\Артём\AppData\Local\Progr ams\Python\Python37-32\lib\site-packag es\pytelegrambotapi-3.6.6-py3.7.egg\telebot\__init__.py", line 390, in polling File "C:\Users\Артём\AppData\Local\Progr ams\Python\Python37-32\lib\site-packag es\pytelegrambotapi-3.6.6-py3.7.egg\telebot\__init__.py", line 413, in __threade d_polling File "C:\Users\Артём\AppData\Local\Progr ams\Python\Python37-32\lib\site-packag es\pytelegrambotapi-3.6.6-py3.7.egg\telebot\util.py", line 79, in raise_exceptio ns File "C:\Users\Артём\AppData\Roaming\Pyt hon\Python37\site-packages\six.py", li ne 693, in reraise raise value File "C:\Users\Артём\AppData\Local\Progr ams\Python\Python37-32\lib\site-packag es\requests\sessions.py", line 533, in request resp = self.send(prep, **send_kwargs) File "C:\Users\Артём\AppData\Local\Progr ams\Python\Python37-32\lib\site-packag es\requests\sessions.py", line 646, in send r = adapter.send(request, **kwargs) File "C:\Users\Артём\AppData\Local\Progr ams\Python\Python37-32\lib\site-packag es\requests\adapters.py", line 514, in send raise SSLError(e, request=request) requests.exceptions.SSLError: HTTPSConnectionPool(host='api.teleg ram.org', port= 443): Max retries exceeded with url: /bot868629624:AAFnTMV0oK3FmH7_yYFPLU EaY4LvF D2TIIY/getUpdates?offset=1&timeout=20 (Caused by SSLError(SSLError("bad handshak e: Error([('SSL routines', 'tls_process_server_certificate', 'certificate verify failed')])"))) Из пип-пакетов только pytelegrambotapi |
05.05.2019, 17:09 | #2 |
Старожил
Регистрация: 15.02.2010
Сообщений: 15,709
|
Проверьте браузером сайт, возможно ваш провайдер подменяет сертификат.
|
05.05.2019, 17:59 | #3 |
Новичок
Джуниор
Регистрация: 05.05.2019
Сообщений: 4
|
Если вы про сайт телеграма, то все работает; проблема в чем то другом
|
05.05.2019, 18:23 | #4 |
Старожил
Регистрация: 15.02.2010
Сообщений: 15,709
|
Хорошо, тогда следущий вопрос: что с вашим сертификатом? он валидный? самодписный или выданный?
|
05.05.2019, 18:31 | #5 |
Новичок
Джуниор
Регистрация: 05.05.2019
Сообщений: 4
|
без понятия о чем вы, из тех статей где я беру материал об этом ничего не говорилось. У меня есть только токен от botfather и всё
|
05.05.2019, 18:41 | #6 |
Новичок
Джуниор
Регистрация: 05.05.2019
Сообщений: 4
|
+ я разве не могу создать локального бота на период разработки ?
|
05.05.2019, 21:02 | #7 |
Программист
Участник клуба
Регистрация: 23.06.2009
Сообщений: 1,772
|
Да не про некоторый абстрактный "сайт телеграма", а на тот конкретный, куда бот стучится: https://api.telegram.org
Очень похоже, что проблема таки в этом. Может, например, оказаться, что в браузере прокси прописан, а бот напрямую стучится |
Похожие темы | ||||
Тема | Автор | Раздел | Ответов | Последнее сообщение |
Telegram API | PTyTb32 | Общие вопросы Delphi | 0 | 29.12.2017 12:30 |
Бот в telegram | Manr63 | Свободное общение | 1 | 28.02.2017 13:58 |
telegram bot | progmen | Фриланс | 2 | 30.11.2016 14:27 |
Нужна помощь с ботом для андроид | KaJIcOn | Помощь студентам | 3 | 05.11.2016 14:56 |
Проблемы с icq ботом с TICQClient | rust-02 | Работа с сетью в Delphi | 6 | 26.12.2010 18:26 |