В настоящее время я работаю с VPN и библиотекой телепотов, которая используется для управления телеграм-ботами.
Когда я пытаюсь прослушать сообщения, возникает ошибка SSL.
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 601, in urlopen
chunked=chunked)
File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 346, in _make_request
self._validate_conn(conn)
File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 852, in validate_conn
conn.connect()
File "/usr/lib/python3/dist-packages/urllib3/connection.py", line 326, in connect
ssl_context=context)
File "/usr/lib/python3/dist-packages/urllib3/util/ssl.py", line 329, in ssl_wrap_socket
return context.wrap_socket(sock, server_hostname=server_hostname)
File "/usr/lib/python3.6/ssl.py", line 407, in wrap_socket
_context=self, _session=session)
File "/usr/lib/python3.6/ssl.py", line 814, in init
self.do_handshake()
File "/usr/lib/python3.6/ssl.py", line 1068, in do_handshake
self._sslobj.do_handshake()
File "/usr/lib/python3.6/ssl.py", line 689, in do_handshake
self._sslobj.do_handshake()
ssl.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:841)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/telepot/init.py", line 1183, in get_from_telegram_server
allowed_updates=allowed_upd)
File "/usr/local/lib/python3.6/dist-packages/telepot/init.py", line 1000, in getUpdates
return self._api_request('getUpdates', _rectify(p))
File "/usr/local/lib/python3.6/dist-packages/telepot/init.py", line 491, in _api_request
return api.request((self._token, method, params, files), kwargs)
File "/usr/local/lib/python3.6/dist-packages/telepot/api.py", line 154, in request
r = fn(args, kwargs) # fn must be thread-safe
File "/usr/lib/python3/dist-packages/urllib3/request.py", line 148, in request_encode_body
return self.urlopen(method, url, extra_kw)
File "/usr/lib/python3/dist-packages/urllib3/poolmanager.py", line 321, in urlopen
response = conn.urlopen(method, u.request_uri, kw)
File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 668, in urlopen
response_kw)
File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 668, in urlopen
response_kw)
File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 668, in urlopen
response_kw)
File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 639, in urlopen
_stacktrace=sys.exc_info()[2])
File "/usr/lib/python3/dist-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: /bot****************/getUpdates (Caused by SSLError(SSLError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:841)'),))
Iрешил это в запросах моего браузера таким образом
context = ssl._create_unverified_context()
ip = urllib.urlopen('https://api.ipify.org', context=context).read()
Но я не смог сделать это для телепота.Любые советы?