Forums

Остановка работы по непонятным причинам

то выдает вот такую ошибку "Traceback (most recent call last): File "/usr/local/lib/python3.10/site-packages/urllib3/connectionpool.py", line 703, in urlopen httplib_response = self._make_request( File "/usr/local/lib/python3.10/site-packages/urllib3/connectionpool.py", line 449, in _make_request six.raise_from(e, None) File "<string>", line 3, in raise_from File "/usr/local/lib/python3.10/site-packages/urllib3/connectionpool.py", line 444, in _make_request httplib_response = conn.getresponse() File "/usr/local/lib/python3.10/http/client.py", line 1374, in getresponse response.begin() File "/usr/local/lib/python3.10/http/client.py", line 318, in begin version, status, reason = self._read_status() File "/usr/local/lib/python3.10/http/client.py", line 287, in _read_status raise RemoteDisconnected("Remote end closed connection without" http.client.RemoteDisconnected: Remote end closed connection without response During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/usr/local/lib/python3.10/site-packages/requests/adapters.py", line 489, in send resp = conn.urlopen( File "/usr/local/lib/python3.10/site-packages/urllib3/connectionpool.py", line 785, in urlopen retries = retries.increment( File "/usr/local/lib/python3.10/site-packages/urllib3/util/retry.py", line 592, 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: /bot6248785602:AAGSUkMK16KqXV2zeXHtxhGIBO9dCQTqTr4/getUpdates?offset=427239697&timeout=2 0 (Caused by ProxyError('Cannot connect to proxy.', RemoteDisconnected('Remote end closed connection without response'))) During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/LevPlayTOP1GG/Bot_TG/bot.py", line 96, in <module> bot.polling(none_stop=True) File "/home/LevPlayTOP1GG/.local/lib/python3.10/site-packages/telebot/init.py", line 1043, in polling self.threaded_polling(non_stop=non_stop, interval=interval, timeout=timeout, long_polling_timeout=long_polling_timeout, File "/home/LevPlayTOP1GG/.local/lib/python3.10/site-packages/telebot/__init.py", line 1118, in threaded_polling raise e File "/home/LevPlayTOP1GG/.local/lib/python3.10/site-packages/telebot/__init.py", line 1073, in __threaded_polling polling_thread.raise_exceptions() File "/home/LevPlayTOP1GG/.local/lib/python3.10/site-packages/telebot/util.py", line 108, in raise_exceptions raise self.exception_info File "/home/LevPlayTOP1GG/.local/lib/python3.10/site-packages/telebot/util.py", line 90, in run task(args, kwargs) File "/home/LevPlayTOP1GG/.local/lib/python3.10/site-packages/telebot/init.py", line 649, in retrieve_updates updates = self.get_updates(offset=(self.last_update_id + 1), File "/home/LevPlayTOP1GG/.local/lib/python3.10/site-packages/telebot/__init.py", line 623, in get_updates json_updates = apihelper.get_updates(self.token, offset, limit, timeout, allowed_updates, long_polling_timeout) File "/home/LevPlayTOP1GG/.local/lib/python3.10/site-packages/telebot/apihelper.py", line 321, in get_updates return _make_request(token, method_url, params=payload) File "/home/LevPlayTOP1GG/.local/lib/python3.10/site-packages/telebot/apihelper.py", line 156, in _make_request result = _get_req_session().request( File "/usr/local/lib/python3.10/site-packages/requests/sessions.py", line 587, in request resp = self.send(prep, send_kwargs) File "/usr/local/lib/python3.10/site-packages/requests/sessions.py", line 701, in send r = adapter.send(request, *kwargs) File "/usr/local/lib/python3.10/site-packages/requests/adapters.py", line 559, in send raise ProxyError(e, request=request) requests.exceptions.ProxyError: HTTPSConnectionPool(host='api.telegram.org', port=443): Max retries exceeded with url: /bot6248785602:AAGSUkMK16KqXV2zeXHtxhGIBO9dCQTqTr4/getUpdates?offset=427239697&timeout=20 (Caused by ProxyError('Cannot connect to proxy.', RemoteDisconnected('Remote end closed connection without response')))" и перестает работать и приходится перезапускать бота или просто никаких ошибок, но всеравно приходится перезапускать бота. Что делать в таком случае, подскажите кто-нибудь

If restarting the bot fixes the issue, then you need to work out what you're re-using that you should be re-creating. What is most likely happening is that there is something that you're creating when you start the bot and then you're re-using it as the bot runs. That thing expires or times out or becomes invalid in some way, so you need to re-create it in your code as the code runs.