SSL Certificate Error (_ssl.c:720)
codesaw opened this issue · 2 comments
Hi, I'm getting errors when trying to send a message. I'm using Raspbian Stretch on a Pi Zero W. It's working fine on a Pi running Raspbian Jessie.
`
Traceback (most recent call last):
File "/home/simon/.local/lib/python3.5/site-packages/urllib3/connectionpool.py", line 603, in urlopen
chunked=chunked)
File "/home/simon/.local/lib/python3.5/site-packages/urllib3/connectionpool.py", line 344, in _make_request
self._validate_conn(conn)
File "/home/simon/.local/lib/python3.5/site-packages/urllib3/connectionpool.py", line 843, in validate_conn
conn.connect()
File "/home/simon/.local/lib/python3.5/site-packages/urllib3/connection.py", line 350, in connect
ssl_context=context)
File "/home/simon/.local/lib/python3.5/site-packages/urllib3/util/ssl.py", line 355, in ssl_wrap_socket
return context.wrap_socket(sock, server_hostname=server_hostname)
File "/usr/lib/python3.5/ssl.py", line 385, in wrap_socket
_context=self)
File "/usr/lib/python3.5/ssl.py", line 760, in init
self.do_handshake()
File "/usr/lib/python3.5/ssl.py", line 996, in do_handshake
self._sslobj.do_handshake()
File "/usr/lib/python3.5/ssl.py", line 641, in do_handshake
self._sslobj.do_handshake()
ssl.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:720)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "./send.py", line 15, in
send(str(sys.argv[1]))
File "./send.py", line 13, in send
bot.sendMessage(bot_chatID, msg)
File "/home/simon/.local/lib/python3.5/site-packages/telepot/init.py", line 513, in sendMessage
return self._api_request('sendMessage', _rectify(p))
File "/home/simon/.local/lib/python3.5/site-packages/telepot/init.py", line 491, in _api_request
return api.request((self._token, method, params, files), **kwargs)
File "/home/simon/.local/lib/python3.5/site-packages/telepot/api.py", line 154, in request
r = fn(*args, **kwargs) # fn
must be thread-safe
File "/home/simon/.local/lib/python3.5/site-packages/urllib3/request.py", line 150, in request_encode_body
return self.urlopen(method, url, **extra_kw)
File "/home/simon/.local/lib/python3.5/site-packages/urllib3/poolmanager.py", line 326, in urlopen
response = conn.urlopen(method, u.request_uri, **kw)
File "/home/simon/.local/lib/python3.5/site-packages/urllib3/connectionpool.py", line 670, in urlopen
**response_kw)
File "/home/simon/.local/lib/python3.5/site-packages/urllib3/connectionpool.py", line 670, in urlopen
**response_kw)
File "/home/simon/.local/lib/python3.5/site-packages/urllib3/connectionpool.py", line 670, in urlopen
**response_kw)
File "/home/simon/.local/lib/python3.5/site-packages/urllib3/connectionpool.py", line 641, in urlopen
_stacktrace=sys.exc_info()[2])
File "/home/simon/.local/lib/python3.5/site-packages/urllib3/util/retry.py", line 399, 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: /botxxxxxx:xxxxxxxxxxxxxxxxxxxxxxxx/sendMessage (Caused by SSLError(SSLError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:720)'),))`
I've tried sending a message from curl using the same system and it works fine:
curl -X POST \ -H 'Content-Type: application/json' \ -d '{"chat_id": "xxxxxxxxxxx", "text": "Test", "disable_notification": true}' \ https://api.telegram.org/botxxxxxxx:xxxxxxxxxxxxx/sendMessage
It would seem the Teleport is no longer supported, which is a shame.
Anyone else having this issue, you need to downgrade urllib3 ---> pip3 install urllib3==1.24.1
It would seem the Teleport is no longer supported, which is a shame.
Anyone else having this issue, you need to downgrade urllib3 ---> pip3 install urllib3==1.24.1
I was facing the same issue here with urllib3 1.25.2.
@codesaw suggestion fixed the problem for now (downgrading urllib3 to 1.24.1), thanks.