Сделал очень простого бота, вот код:
import telebot
import configure
client = telebot.TeleBot(configure.config['token'])
@client.message_handler(content_types = ['text'])
def get_text(message):
if message.text.lower() == 'привет':
client.send_message(message.chat.id, 'Привет, юзер)')
else:
client.send_message(message.chat.id, message.text)
client.polling(none_stop = True)
В файле configure токен, вот ошибка:
2020-06-17 14:57:07,694 (util.py:68 PollingThread) ERROR - TeleBot: "ConnectionError occurred, args=(MaxRetryError("HTTPSConnectionPool(host='api.telegram.org', port=443):
Max retries exceeded with url: /bot1279222057:AAHxnx3M5eZHyfnk1lsJnXq9EowPMtL0Izk/getUpdates?offset=1&timeout=20 (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x03D35940>: Failed to establish a new connection: [WinError 10051] Сделана попытка выполнить операцию на сокете при отключенной сети'))"),)
Traceback (most recent call last):
File "C:\Users\MIKHANGO\AppData\Local\Programs\Python\Python38-32\lib\site-packages\urllib3\connection.py", line 140, in _new_conn
conn = connection.create_connection(
File "C:\Users\MIKHANGO\AppData\Local\Programs\Python\Python38-32\lib\site-packages\urllib3\util\connection.py", line 83, in create_connection
raise err
File "C:\Users\MIKHANGO\AppData\Local\Programs\Python\Python38-32\lib\site-packages\urllib3\util\connection.py", line 73, in create_connection
sock.connect(sa)
OSError: [WinError 10051] Сделана попытка выполнить операцию на сокете при отключенной сети
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\MIKHANGO\AppData\Local\Programs\Python\Python38-32\lib\site-packages\urllib3\connectionpool.py", line 598, in urlopen
httplib_response = self._make_request(conn, method, url,
File "C:\Users\MIKHANGO\AppData\Local\Programs\Python\Python38-32\lib\site-packages\urllib3\connectionpool.py", line 346, in _make_request
self._validate_conn(conn)
File "C:\Users\MIKHANGO\AppData\Local\Programs\Python\Python38-32\lib\site-packages\urllib3\connectionpool.py", line 850, in _validate_conn
conn.connect()
File "C:\Users\MIKHANGO\AppData\Local\Programs\Python\Python38-32\lib\site-packages\urllib3\connection.py", line 284, in connect
conn = self._new_conn()
File "C:\Users\MIKHANGO\AppData\Local\Programs\Python\Python38-32\lib\site-packages\urllib3\connection.py", line 149, in _new_conn
raise NewConnectionError(
urllib3.exceptions.NewConnectionError: <urllib3.connection.VerifiedHTTPSConnection object at 0x03D35940>: Failed to establish a new connection: [WinError 10051] Сделана попытка выполнить операцию на сокете при отключенной сети
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\MIKHANGO\AppData\Local\Programs\Python\Python38-32\lib\site-packages\requests\adapters.py", line 430, in send
resp = conn.urlopen(
File "C:\Users\MIKHANGO\AppData\Local\Programs\Python\Python38-32\lib\site-packages\urllib3\connectionpool.py", line 638, in urlopen
retries = retries.increment(method, url, error=e, _pool=self,
File "C:\Users\MIKHANGO\AppData\Local\Programs\Python\Python38-32\lib\site-packages\urllib3\util\retry.py", line 388, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='api.telegram.org', port=443): Max retries exceeded with url: /bot1279222057:AAHxnx3M5eZHyfnk1lsJnXq9EowPMtL0Izk/getUpdates?offset=1&timeout=20 (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x03D35940>: Failed to establish a new connection: [WinError 10051] Сделана попытка выполнить операцию на сокете при отключенной сети'))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\MIKHANGO\AppData\Local\Programs\Python\Python38-32\lib\site-packages\telebot\util.py", line 62, in run
task(*args, **kwargs)
File "C:\Users\MIKHANGO\AppData\Local\Programs\Python\Python38-32\lib\site-packages\telebot\__init__.py", line 281, in __retrieve_updates
updates = self.get_updates(offset=(self.last_update_id + 1), timeout=timeout)
File "C:\Users\MIKHANGO\AppData\Local\Programs\Python\Python38-32\lib\site-packages\telebot\__init__.py", line 251, in get_updates
json_updates = apihelper.get_updates(self.token, offset, limit, timeout, allowed_updates)
File "C:\Users\MIKHANGO\AppData\Local\Programs\Python\Python38-32\lib\site-packages\telebot\apihelper.py", line 199, in get_updates
return _make_request(token, method_url, params=payload)
File "C:\Users\MIKHANGO\AppData\Local\Programs\Python\Python38-32\lib\site-packages\telebot\apihelper.py", line 62, in _make_request
result = _get_req_session().request(method, request_url, params=params, files=files,
File "C:\Users\MIKHANGO\AppData\Local\Programs\Python\Python38-32\lib\site-packages\requests\sessions.py", line 508, in request
resp = self.send(prep, **send_kwargs)
File "C:\Users\MIKHANGO\AppData\Local\Programs\Python\Python38-32\lib\site-packages\requests\sessions.py", line 618, in send
r = adapter.send(request, **kwargs)
File "C:\Users\MIKHANGO\AppData\Local\Programs\Python\Python38-32\lib\site-packages\requests\adapters.py", line 508, in send
raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='api.telegram.org', port=443): Max retries exceeded with url: /bot1279222057:AAHxnx3M5eZHyfnk1lsJnXq9EowPMtL0Izk/getUpdates?offset=1&timeout=20 (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x03D35940>: Failed to establish a new connection: [WinError 10051] Сделана попытка выполнить операцию на сокете при отключенной сети'))
"
Traceback (most recent call last):
File "C:\Users\MIKHANGO\AppData\Local\Programs\Python\Python38-32\lib\site-packages\urllib3\connection.py", line 140, in _new_conn
conn = connection.create_connection(
File "C:\Users\MIKHANGO\AppData\Local\Programs\Python\Python38-32\lib\site-packages\urllib3\util\connection.py", line 83, in create_connection
raise err
File "C:\Users\MIKHANGO\AppData\Local\Programs\Python\Python38-32\lib\site-packages\urllib3\util\connection.py", line 73, in create_connection
sock.connect(sa)
OSError: [WinError 10051] Сделана попытка выполнить операцию на сокете при отключенной сети
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\MIKHANGO\AppData\Local\Programs\Python\Python38-32\lib\site-packages\urllib3\connectionpool.py", line 598, in urlopen
httplib_response = self._make_request(conn, method, url,
File "C:\Users\MIKHANGO\AppData\Local\Programs\Python\Python38-32\lib\site-packages\urllib3\connectionpool.py", line 346, in _make_request
self._validate_conn(conn)
File "C:\Users\MIKHANGO\AppData\Local\Programs\Python\Python38-32\lib\site-packages\urllib3\connectionpool.py", line 850, in _validate_conn
conn.connect()
File "C:\Users\MIKHANGO\AppData\Local\Programs\Python\Python38-32\lib\site-packages\urllib3\connection.py", line 284, in connect
conn = self._new_conn()
File "C:\Users\MIKHANGO\AppData\Local\Programs\Python\Python38-32\lib\site-packages\urllib3\connection.py", line 149, in _new_conn
raise NewConnectionError(
urllib3.exceptions.NewConnectionError: <urllib3.connection.VerifiedHTTPSConnection object at 0x03D35940>: Failed to establish a new connection: [WinError 10051] Сделана попытка выполнить операцию на сокете при отключенной сети
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\MIKHANGO\AppData\Local\Programs\Python\Python38-32\lib\site-packages\requests\adapters.py", line 430, in send
resp = conn.urlopen(
File "C:\Users\MIKHANGO\AppData\Local\Programs\Python\Python38-32\lib\site-packages\urllib3\connectionpool.py", line 638, in urlopen
retries = retries.increment(method, url, error=e, _pool=self,
File "C:\Users\MIKHANGO\AppData\Local\Programs\Python\Python38-32\lib\site-packages\urllib3\util\retry.py", line 388, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='api.telegram.org', port=443): Max retries exceeded with url: /bot1279222057:AAHxnx3M5eZHyfnk1lsJnXq9EowPMtL0Izk/getUpdates?offset=1&timeout=20 (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x03D35940>: Failed to establish a new connection: [WinError 10051] Сделана попытка выполнить операцию на сокете при отключенной сети'))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "d:/MISHA/Programming/Python/MYPROJECTS/bot/bot.py", line 13, in <module>
client.polling(none_stop = True)
File "C:\Users\MIKHANGO\AppData\Local\Programs\Python\Python38-32\lib\site-packages\telebot\__init__.py", line 415, in polling
self.__threaded_polling(none_stop, interval, timeout)
File "C:\Users\MIKHANGO\AppData\Local\Programs\Python\Python38-32\lib\site-packages\telebot\__init__.py", line 438, in __threaded_polling
polling_thread.raise_exceptions()
File "C:\Users\MIKHANGO\AppData\Local\Programs\Python\Python38-32\lib\site-packages\telebot\util.py", line 81, in raise_exceptions
six.reraise(self.exc_info[0], self.exc_info[1], self.exc_info[2])
File "C:\Users\MIKHANGO\AppData\Roaming\Python\Python38\site-packages\six.py", line 703, in reraise
raise value
File "C:\Users\MIKHANGO\AppData\Local\Programs\Python\Python38-32\lib\site-packages\telebot\util.py", line 62, in run
task(*args, **kwargs)
File "C:\Users\MIKHANGO\AppData\Local\Programs\Python\Python38-32\lib\site-packages\telebot\__init__.py", line 281, in __retrieve_updates
updates = self.get_updates(offset=(self.last_update_id + 1), timeout=timeout)
File "C:\Users\MIKHANGO\AppData\Local\Programs\Python\Python38-32\lib\site-packages\telebot\__init__.py", line 251, in get_updates
json_updates = apihelper.get_updates(self.token, offset, limit, timeout, allowed_updates)
File "C:\Users\MIKHANGO\AppData\Local\Programs\Python\Python38-32\lib\site-packages\telebot\apihelper.py", line 199, in get_updates
return _make_request(token, method_url, params=payload)
File "C:\Users\MIKHANGO\AppData\Local\Programs\Python\Python38-32\lib\site-packages\telebot\apihelper.py", line 62, in _make_request
result = _get_req_session().request(method, request_url, params=params, files=files,
File "C:\Users\MIKHANGO\AppData\Local\Programs\Python\Python38-32\lib\site-packages\requests\sessions.py", line 508, in request
resp = self.send(prep, **send_kwargs)
File "C:\Users\MIKHANGO\AppData\Local\Programs\Python\Python38-32\lib\site-packages\requests\sessions.py", line 618, in send
r = adapter.send(request, **kwargs)
File "C:\Users\MIKHANGO\AppData\Local\Programs\Python\Python38-32\lib\site-packages\requests\adapters.py", line 508, in send
raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='api.telegram.org', port=443): Max retries exceeded with url: /bot1279222057:AAHxnx3M5eZHyfnk1lsJnXq9EowPMtL0Izk/getUpdates?offset=1&timeout=20 (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x03D35940>: Failed to establish a new connection: [WinError 10051] Сделана попытка выполнить операцию на сокете при отключенной сети'))
Что делать?