Хочу написать бота для Телеграм, но, когда запускаю, выдаёт эту ошибку:
2019-09-26 23:13:26,186 (util.py:65 PollingThread) ERROR - TeleBot: "ConnectTime
out occurred, args=(MaxRetryError("HTTPSConnectionPool(host='api.telegram.org',
port=443): Max retries exceeded with url: /bot926490118:AAF3_w_8q4jGufsI6ekUSLzO
7DxSune3nVU/getUpdates?offset=1&timeout=20 (Caused by ConnectTimeoutError(<urlli
b3.connection.VerifiedHTTPSConnection object at 0x02DE8DD0>, 'Connection to api.
telegram.org timed out. (connect timeout=3.5)'))"),)
Traceback (most recent call last):
File "C:\Users\User\AppData\Local\Programs\Python\Python37-32\lib\site-package
s\urllib3\connection.py", line 157, in _new_conn
(self._dns_host, self.port), self.timeout, **extra_kw
File "C:\Users\User\AppData\Local\Programs\Python\Python37-32\lib\site-package
s\urllib3\util\connection.py", line 84, in create_connection
raise err
File "C:\Users\User\AppData\Local\Programs\Python\Python37-32\lib\site-package
s\urllib3\util\connection.py", line 74, in create_connection
sock.connect(sa)
socket.timeout: timed out
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\User\AppData\Local\Programs\Python\Python37-32\lib\site-package
s\urllib3\connectionpool.py", line 672, in urlopen
chunked=chunked,
File "C:\Users\User\AppData\Local\Programs\Python\Python37-32\lib\site-package
s\urllib3\connectionpool.py", line 376, in _make_request
self._validate_conn(conn)
File "C:\Users\User\AppData\Local\Programs\Python\Python37-32\lib\site-package
s\urllib3\connectionpool.py", line 994, in _validate_conn
conn.connect()
File "C:\Users\User\AppData\Local\Programs\Python\Python37-32\lib\site-package
s\urllib3\connection.py", line 334, in connect
conn = self._new_conn()
File "C:\Users\User\AppData\Local\Programs\Python\Python37-32\lib\site-package
s\urllib3\connection.py", line 164, in _new_conn
% (self.host, self.timeout),
urllib3.exceptions.ConnectTimeoutError: (<urllib3.connection.VerifiedHTTPSConnec
tion object at 0x02DE8DD0>, 'Connection to api.telegram.org timed out. (connect
timeout=3.5)')
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\User\AppData\Local\Programs\Python\Python37-32\lib\site-package
s\requests\adapters.py", line 449, in send
timeout=timeout
File "C:\Users\User\AppData\Local\Programs\Python\Python37-32\lib\site-package
s\urllib3\connectionpool.py", line 720, in urlopen
method, url, error=e, _pool=self, _stacktrace=sys.exc_info()[2]
File "C:\Users\User\AppData\Local\Programs\Python\Python37-32\lib\site-package
s\urllib3\util\retry.py", line 436, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='api.telegram.org', p
ort=443): Max retries exceeded with url: /bot926490118:AAF3_w_8q4jGufsI6ekUSLzO7
DxSune3nVU/getUpdates?offset=1&timeout=20 (Caused by ConnectTimeoutError(<urllib
3.connection.VerifiedHTTPSConnection object at 0x02DE8DD0>, 'Connection to api.t
elegram.org timed out. (connect timeout=3.5)'))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\User\AppData\Local\Programs\Python\Python37-32\lib\site-package
s\telebot\util.py", line 59, in run
task(*args, **kwargs)
File "C:\Users\User\AppData\Local\Programs\Python\Python37-32\lib\site-package
s\telebot\__init__.py", line 276, in __retrieve_updates
updates = self.get_updates(offset=(self.last_update_id + 1), timeout=timeout
)
File "C:\Users\User\AppData\Local\Programs\Python\Python37-32\lib\site-package
s\telebot\__init__.py", line 246, in get_updates
json_updates = apihelper.get_updates(self.token, offset, limit, timeout, all
owed_updates)
File "C:\Users\User\AppData\Local\Programs\Python\Python37-32\lib\site-package
s\telebot\apihelper.py", line 180, in get_updates
return _make_request(token, method_url, params=payload)
File "C:\Users\User\AppData\Local\Programs\Python\Python37-32\lib\site-packa
ge
s\telebot\apihelper.py", line 54, in _make_request
timeout=(connect_timeout, read_timeout), proxies=proxy)
File "C:\Users\User\AppData\Local\Programs\Python\Python37-32\lib\site-package
s\requests\sessions.py", line 533, in request
resp = self.send(prep, **send_kwargs)
File "C:\Users\User\AppData\Local\Programs\Python\Python37-32\lib\site-package
s\requests\sessions.py", line 646, in send
r = adapter.send(request, **kwargs)
File "C:\Users\User\AppData\Local\Programs\Python\Python37-32\lib\site-package
s\requests\adapters.py", line 504, in send
raise ConnectTimeout(e, request=request)
requests.exceptions.ConnectTimeout: HTTPSConnectionPool(host='api.telegram.org',
port=443): Max retries exceeded with url: /bot926490118:AAF3_w_8q4jGufsI6ekUSLz
O7DxSune3nVU/getUpdates?offset=1&timeout=20 (Caused by ConnectTimeoutError(<urll
ib3.connection.VerifiedHTTPSConnection object at 0x02DE8DD0>, 'Connection to api
.telegram.org timed out. (connect timeout=3.5)'))
"
Traceback (most recent call last):
File "C:\Users\User\AppData\Local\Programs\Python\Python37-32\lib\site-package
s\urllib3\connection.py", line 157, in _new_conn
(self._dns_host, self.port), self.timeout, **extra_kw
File "C:\Users\User\AppData\Local\Programs\Python\Python37-32\lib\site-package
s\urllib3\util\connection.py", line 84, in create_connection
raise err
File "C:\Users\User\AppData\Local\Programs\Python\Python37-32\lib\site-package
s\urllib3\util\connection.py", line 74, in create_connection
sock.connect(sa)
socket.timeout: timed out
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\User\AppData\Local\Programs\Python\Python37-32\lib\site-package
s\urllib3\connectionpool.py", line 672, in urlopen
chunked=chunked,
File "C:\Users\User\AppData\Local\Programs\Python\Python37-32\lib\site-package
s\urllib3\connectionpool.py", line 376, in _make_request
self._validate_conn(conn)
File "C:\Users\User\AppData\Local\Programs\Python\Python37-32\lib\site-package
s\urllib3\connectionpool.py", line 994, in _validate_conn
conn.connect()
File "C:\Users\User\AppData\Local\Programs\Python\Python37-32\lib\site-package
s\urllib3\connection.py", line 334, in connect
conn = self._new_conn()
File "C:\Users\User\AppData\Local\Programs\Python\Python37-32\lib\site-package
s\urllib3\connection.py", line 164, in _new_conn
% (self.host, self.timeout),
urllib3.exceptions.ConnectTimeoutError: (<urllib3.connection.VerifiedHTTPSConnec
tion object at 0x02DE8DD0>, 'Connection to api.telegram.org timed out. (connect
timeout=3.5)')
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\User\AppData\Local\Programs\Python\Python37-32\lib\site-package
s\requests\adapters.py", line 449, in send
timeout=timeout
File "C:\Users\User\AppData\Local\Programs\Python\Python37-32\lib\site-package
s\urllib3\connectionpool.py", line 720, in urlopen
method, url, error=e, _pool=self, _stacktrace=sys.exc_info()[2]
File "C:\Users\User\AppData\Local\Programs\Python\Python37-32\lib\site-package
s\urllib3\util\retry.py", line 436, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='api.telegram.org', p
ort=443): Max retries exceeded with url: /bot926490118:AAF3_w_8q4jGufsI6ekUSLzO7
DxSune3nVU/getUpdates?offset=1&timeout=20 (Caused by ConnectTimeoutError(<urllib
3.connection.VerifiedHTTPSConnection object at 0x02DE8DD0>, 'Connection to api.t
elegram.org timed out. (connect timeout=3.5)'))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "D:\bot.py", line 11, in <module>
bot.polling(none_stop=True)
File "C:\Users\User\AppData\Local\Programs\Python\Python37-32\lib\site-package
s\telebot\__init__.py", line 389, in polling
self.__threaded_polling(none_stop, interval, timeout)
File "C:\Users\User\AppData\Local\Programs\Python\Python37-32\lib\site-pack
uests\adapters.py", line 504, in send
raise ConnectTimeout(e, request=request)
requests.exceptions.ConnectTimeout: HTTPSConnectionPool(host='api.telegram.org',
port=443): Max retries exceeded with url: /bot926490118:AAF3_w_8q4jGufsI6ekUSLz
O7DxSune3nVU/getUpdates?offset=1&timeout=20 (Caused by ConnectTimeoutError(<urll
ib3.connection.VerifiedHTTPSConnection object at 0x02DE8DD0>, 'Connection to api
Telegram
заблокирован на территории РФ. Вы используетеproxy
? И, пожалуйста, приведите в вопрос Ваш код.