Black Lives Matter. Please consider donating to Black Girls Code today.

Fig upload fails with 'Error: [('SSL routines', 'ssl3_get_server_certificate', 'certificate verify failed')]'

In Jupyter, I am loading chart studio and the appropriate AIP key (freshly regenerated) and updated in both .credentials and my .env file to feed into the chart studio instance.

When I try to use cs.plotly.plot(fig, filename = 'comp_vs_coding', auto_open=True) to publish my figure, I get the below. Any hints as to what I might be doing wrong?

Error                                     Traceback (most recent call last)
~\Anaconda3\lib\site-packages\urllib3\contrib\pyopenssl.py in wrap_socket(self, sock, server_side, do_handshake_on_connect, suppress_ragged_eofs, server_hostname)
    440             try:
--> 441                 cnx.do_handshake()
    442             except OpenSSL.SSL.WantReadError:

~\Anaconda3\lib\site-packages\OpenSSL\SSL.py in do_handshake(self)
   1906         result = _lib.SSL_do_handshake(self._ssl)
-> 1907         self._raise_ssl_error(self._ssl, result)
   1908 

~\Anaconda3\lib\site-packages\OpenSSL\SSL.py in _raise_ssl_error(self, ssl, result)
   1638         else:
-> 1639             _raise_current_error()
   1640 

~\Anaconda3\lib\site-packages\OpenSSL\_util.py in exception_from_error_queue(exception_type)
     53 
---> 54     raise exception_type(errors)
     55 

Error: [('SSL routines', 'ssl3_get_server_certificate', 'certificate verify failed')]

During handling of the above exception, another exception occurred:

SSLError                                  Traceback (most recent call last)
~\Anaconda3\lib\site-packages\urllib3\connectionpool.py in urlopen(self, method, url, body, headers, retries, redirect, assert_same_host, timeout, pool_timeout, release_conn, chunked, body_pos, **response_kw)
    600                                                   body=body, headers=headers,
--> 601                                                   chunked=chunked)
    602 

~\Anaconda3\lib\site-packages\urllib3\connectionpool.py in _make_request(self, conn, method, url, timeout, chunked, **httplib_request_kw)
    345         try:
--> 346             self._validate_conn(conn)
    347         except (SocketTimeout, BaseSSLError) as e:

~\Anaconda3\lib\site-packages\urllib3\connectionpool.py in _validate_conn(self, conn)
    849         if not getattr(conn, 'sock', None):  # AppEngine might not have  `.sock`
--> 850             conn.connect()
    851 

~\Anaconda3\lib\site-packages\urllib3\connection.py in connect(self)
    325             server_hostname=hostname,
--> 326             ssl_context=context)
    327 

~\Anaconda3\lib\site-packages\urllib3\util\ssl_.py in ssl_wrap_socket(sock, keyfile, certfile, cert_reqs, ca_certs, server_hostname, ssl_version, ciphers, ssl_context, ca_cert_dir)
    328     if HAS_SNI:  # Platform-specific: OpenSSL with enabled SNI
--> 329         return context.wrap_socket(sock, server_hostname=server_hostname)
    330 

~\Anaconda3\lib\site-packages\urllib3\contrib\pyopenssl.py in wrap_socket(self, sock, server_side, do_handshake_on_connect, suppress_ragged_eofs, server_hostname)
    447             except OpenSSL.SSL.Error as e:
--> 448                 raise ssl.SSLError('bad handshake: %r' % e)
    449             break

SSLError: ("bad handshake: Error([('SSL routines', 'ssl3_get_server_certificate', 'certificate verify failed')],)",)

During handling of the above exception, another exception occurred:

MaxRetryError                             Traceback (most recent call last)
~\Anaconda3\lib\site-packages\requests\adapters.py in send(self, request, stream, timeout, verify, cert, proxies)
    439                     retries=self.max_retries,
--> 440                     timeout=timeout
    441                 )

~\Anaconda3\lib\site-packages\urllib3\connectionpool.py in urlopen(self, method, url, body, headers, retries, redirect, assert_same_host, timeout, pool_timeout, release_conn, chunked, body_pos, **response_kw)
    638             retries = retries.increment(method, url, error=e, _pool=self,
--> 639                                         _stacktrace=sys.exc_info()[2])
    640             retries.sleep()

~\Anaconda3\lib\site-packages\urllib3\util\retry.py in increment(self, method, url, response, error, _pool, _stacktrace)
    387         if new_retry.is_exhausted():
--> 388             raise MaxRetryError(_pool, url, error or ResponseError(cause))
    389 

MaxRetryError: HTTPSConnectionPool(host='api.plotly.com', port=443): Max retries exceeded with url: /v2/grids (Caused by SSLError(SSLError("bad handshake: Error([('SSL routines', 'ssl3_get_server_certificate', 'certificate verify failed')],)",),))

During handling of the above exception, another exception occurred:

SSLError                                  Traceback (most recent call last)
~\Anaconda3\lib\site-packages\chart_studio\api\v2\utils.py in request(method, url, **kwargs)
    171     try:
--> 172         response = requests.request(method, url, **kwargs)
    173     except RequestException as e:

~\Anaconda3\lib\site-packages\requests\api.py in request(method, url, **kwargs)
     57     with sessions.Session() as session:
---> 58         return session.request(method=method, url=url, **kwargs)
     59 

~\Anaconda3\lib\site-packages\requests\sessions.py in request(self, method, url, params, data, headers, cookies, files, auth, timeout, allow_redirects, proxies, hooks, stream, verify, cert, json)
    507         send_kwargs.update(settings)
--> 508         resp = self.send(prep, **send_kwargs)
    509 

~\Anaconda3\lib\site-packages\requests\sessions.py in send(self, request, **kwargs)
    617         # Send the request
--> 618         r = adapter.send(request, **kwargs)
    619 

~\Anaconda3\lib\site-packages\requests\adapters.py in send(self, request, stream, timeout, verify, cert, proxies)
    505                 # This branch is for urllib3 v1.22 and later.
--> 506                 raise SSLError(e, request=request)
    507 

SSLError: HTTPSConnectionPool(host='api.plotly.com', port=443): Max retries exceeded with url: /v2/grids (Caused by SSLError(SSLError("bad handshake: Error([('SSL routines', 'ssl3_get_server_certificate', 'certificate verify failed')],)",),))

During handling of the above exception, another exception occurred:

PlotlyRequestError                        Traceback (most recent call last)
<ipython-input-7-d6c310fc89ea> in <module>()
      9                 )
     10 fig.show()
---> 11 cs.plotly.plot(fig, filename = 'comp_vs_coding', auto_open=True)

~\Anaconda3\lib\site-packages\chart_studio\plotly\plotly.py in plot(figure_or_data, validate, **plot_options)
    278             filename=grid_filename,
    279             world_readable=payload["world_readable"],
--> 280             auto_open=False,
    281         )
    282 

~\Anaconda3\lib\site-packages\chart_studio\plotly\plotly.py in upload(cls, grid, filename, world_readable, auto_open, meta)
   1085                 payload["parent_path"] = parent_path
   1086 
-> 1087         file_info = _create_or_overwrite_grid(payload)
   1088 
   1089         cols = file_info["cols"]

~\Anaconda3\lib\site-packages\chart_studio\plotly\plotly.py in _create_or_overwrite_grid(data, max_retries)
   1548     # Create file
   1549     try:
-> 1550         res = api_module.create(data)
   1551     except exceptions.PlotlyRequestError as e:
   1552         if max_retries > 0 and "already exists" in e.message:

~\Anaconda3\lib\site-packages\chart_studio\api\v2\grids.py in create(body)
     16     """
     17     url = build_url(RESOURCE)
---> 18     return request("post", url, json=body)
     19 
     20 

~\Anaconda3\lib\site-packages\retrying.py in wrapped_f(*args, **kw)
     47             @six.wraps(f)
     48             def wrapped_f(*args, **kw):
---> 49                 return Retrying(*dargs, **dkw).call(f, *args, **kw)
     50 
     51             return wrapped_f

~\Anaconda3\lib\site-packages\retrying.py in call(self, fn, *args, **kwargs)
    204 
    205             if not self.should_reject(attempt):
--> 206                 return attempt.get(self._wrap_exception)
    207 
    208             delay_since_first_attempt_ms = int(round(time.time() * 1000)) - start_time

~\Anaconda3\lib\site-packages\retrying.py in get(self, wrap_exception)
    245                 raise RetryError(self)
    246             else:
--> 247                 six.reraise(self.value[0], self.value[1], self.value[2])
    248         else:
    249             return self.value

~\Anaconda3\lib\site-packages\six.py in reraise(tp, value, tb)
    691             if value.__traceback__ is not tb:
    692                 raise value.with_traceback(tb)
--> 693             raise value
    694         finally:
    695             value = None

~\Anaconda3\lib\site-packages\retrying.py in call(self, fn, *args, **kwargs)
    198         while True:
    199             try:
--> 200                 attempt = Attempt(fn(*args, **kwargs), attempt_number, False)
    201             except:
    202                 tb = sys.exc_info()

~\Anaconda3\lib\site-packages\chart_studio\api\v2\utils.py in request(method, url, **kwargs)
    177         status_code = response.status_code if response else None
    178         content = response.content if response else "No content"
--> 179         raise exceptions.PlotlyRequestError(message, status_code, content)
    180     validate_response(response)
    181     return response

PlotlyRequestError: No message