title: Is there a way to solve an ssl error (DH key too small) on python when using pd.read_excel()?
body: <p>I am trying to read an excel table that can be accessed through an url, and load it into a DataFrame.</p>
  <p>I'm using pd.read_excel like so:</p>
  <pre><code>
  url = &quot;https://www.recope.go.cr/wp-content/uploads/2020/09/PRECIOS-HIST%C3%93RICOS-CONSUMIDOR-FINAL-1-2.xls&quot;
  df = pd.read_excel(url,header=[2,3,4],nrows=347)
  </code></pre>
  <p>and I get :</p>
  <pre><code>Traceback (most recent call last):
    File &quot;/usr/local/lib/python3.7/urllib/request.py&quot;, line 1350, in do_open
      encode_chunked=req.has_header('Transfer-encoding'))
    File &quot;/usr/local/lib/python3.7/http/client.py&quot;, line 1277, in request
      self._send_request(method, url, body, headers, encode_chunked)
    File &quot;/usr/local/lib/python3.7/http/client.py&quot;, line 1323, in _send_request
      self.endheaders(body, encode_chunked=encode_chunked)
    File &quot;/usr/local/lib/python3.7/http/client.py&quot;, line 1272, in endheaders
      self._send_output(message_body, encode_chunked=encode_chunked)
    File &quot;/usr/local/lib/python3.7/http/client.py&quot;, line 1032, in _send_output
      self.send(msg)
    File &quot;/usr/local/lib/python3.7/http/client.py&quot;, line 972, in send
      self.connect()
    File &quot;/usr/local/lib/python3.7/http/client.py&quot;, line 1447, in connect
      server_hostname=server_hostname)
    File &quot;/usr/local/lib/python3.7/ssl.py&quot;, line 423, in wrap_socket
      session=session
    File &quot;/usr/local/lib/python3.7/ssl.py&quot;, line 870, in _create
      self.do_handshake()
    File &quot;/usr/local/lib/python3.7/ssl.py&quot;, line 1139, in do_handshake
      self._sslobj.do_handshake()
  ssl.SSLError: [SSL: DH_KEY_TOO_SMALL] dh key too small (_ssl.c:1091)
  
  During handling of the above exception, another exception occurred:
  
  Traceback (most recent call last):
    File &quot;&lt;stdin&gt;&quot;, line 1, in &lt;module&gt;
    File &quot;/usr/local/lib/python3.7/site-packages/pandas/util/_decorators.py&quot;, line 299, in wrapper
      return func(*args, **kwargs)
    File &quot;/usr/local/lib/python3.7/site-packages/pandas/io/excel/_base.py&quot;, line 336, in read_excel
      io = ExcelFile(io, storage_options=storage_options, engine=engine)
    File &quot;/usr/local/lib/python3.7/site-packages/pandas/io/excel/_base.py&quot;, line 1063, in __init__
      path=str(self._io), storage_options=storage_options
    File &quot;/usr/local/lib/python3.7/site-packages/pandas/io/excel/_base.py&quot;, line 939, in inspect_excel_format
      content_or_path, &quot;rb&quot;, storage_options=storage_options, is_text=False
    File &quot;/usr/local/lib/python3.7/site-packages/pandas/io/common.py&quot;, line 563, in get_handle
      storage_options=storage_options,
    File &quot;/usr/local/lib/python3.7/site-packages/pandas/io/common.py&quot;, line 288, in _get_filepath_or_buffer
      req = urlopen(filepath_or_buffer)
    File &quot;/usr/local/lib/python3.7/site-packages/pandas/io/common.py&quot;, line 194, in urlopen
      return urllib.request.urlopen(*args, **kwargs)
    File &quot;/usr/local/lib/python3.7/urllib/request.py&quot;, line 222, in urlopen
      return opener.open(url, data, timeout)
    File &quot;/usr/local/lib/python3.7/urllib/request.py&quot;, line 525, in open
      response = self._open(req, data)
    File &quot;/usr/local/lib/python3.7/urllib/request.py&quot;, line 543, in _open
      '_open', req)
    File &quot;/usr/local/lib/python3.7/urllib/request.py&quot;, line 503, in _call_chain
      result = func(*args)
    File &quot;/usr/local/lib/python3.7/urllib/request.py&quot;, line 1393, in https_open
      context=self._context, check_hostname=self._check_hostname)
    File &quot;/usr/local/lib/python3.7/urllib/request.py&quot;, line 1352, in do_open
      raise URLError(err)
  urllib.error.URLError: &lt;urlopen error [SSL: DH_KEY_TOO_SMALL] dh key too small (_ssl.c:1091)&gt;
  </code></pre>
  <p>I saw something similar in <a href="https://stackoverflow.com/questions/38015537/python-requests-exceptions-sslerror-dh-key-too-small">this question</a> but I tried to include the answer code in mine to no avail. I'm a bit new to this but as I couldn't find a solution I thought best to ask here. Is there any way to get around this ssl error?</p>