While writing the test for my side project, I encountered a problem which didn't happen while using Travis CI but CircleCI.

TL;DR

Add

sudo sed -i -E 's/MinProtocol[=\ ]+.*/MinProtocol = TLSv1.0/g' /etc/ssl/openssl.cnf

in .circleci/config.yml before running the test which will connect to the website uses TLSv1.0.

Exception

Traceback (most recent call last):
  File "/home/circleci/repo/venv/lib/python3.5/site-packages/urllib3/connectionpool.py", line 677, in urlopen
    chunked=chunked,
  File "/home/circleci/repo/venv/lib/python3.5/site-packages/urllib3/connectionpool.py", line 381, in _make_request
    self._validate_conn(conn)
  File "/home/circleci/repo/venv/lib/python3.5/site-packages/urllib3/connectionpool.py", line 976, in _validate_conn
    conn.connect()
  File "/home/circleci/repo/venv/lib/python3.5/site-packages/urllib3/connection.py", line 370, in connect
    ssl_context=context,
  File "/home/circleci/repo/venv/lib/python3.5/site-packages/urllib3/util/ssl_.py", line 377, in ssl_wrap_socket
    return context.wrap_socket(sock, server_hostname=server_hostname)
  File "/usr/local/lib/python3.5/ssl.py", line 385, in wrap_socket
    _context=self)
  File "/usr/local/lib/python3.5/ssl.py", line 760, in __init__
    self.do_handshake()
  File "/usr/local/lib/python3.5/ssl.py", line 996, in do_handshake
    self._sslobj.do_handshake()
  File "/usr/local/lib/python3.5/ssl.py", line 641, in do_handshake
    self._sslobj.do_handshake()
ssl.SSLError: [SSL: UNSUPPORTED_PROTOCOL] unsupported protocol (_ssl.c:728)

Another solution which DIDN'T work for me

import requests
import ssl

requests.get(url, verify=ssl.CERT_NONE)

References


Share


Donation

如果覺得這篇文章對你有幫助, 除了留言讓我知道外, 或許也可以考慮請我喝杯咖啡, 不論金額多寡我都會非常感激且能鼓勵我繼續寫出對你有幫助的文章。

If this blog post happens to be helpful to you, besides of leaving a reply, you may consider buy me a cup of coffee to support me. It would help me write more articles helpful to you in the future and I would really appreciate it.


Related Posts