Black Lives Matter. Please consider donating to Black Girls Code today.
https://www.blackgirlscode.com

Login error when i am trying to connect

import chart_studio.plotly as py
import plotly.figure_factory as ff
import numpy as np

import pandas_datareader as pdr
import datetime 

vale3 = pdr.get_data_yahoo('GOOG', 
                          start=datetime.datetime(2016, 10, 1), 
                          end=datetime.datetime(2019, 1, 1))

# Daily log returns
daily_log_returns = np.log(vale3.Close.pct_change()+1)

plotly_username = "murthysuresh"
plotly_key = "FsxorMgIUHp1XhAlKbHh"

# auth to plotly 
py.sign_in(plotly_username, plotly_key)
data = [go.Histogram(x=daily_log_returns)]
py.iplot(data, filename='basic histogram')

I am trying to plot a chart but i get error. HOw do i fix it?


Error Traceback (most recent call last)
~\AppData\Local\Continuum\anaconda3\envs\zip3.6\lib\site-packages\urllib3\contrib\pyopenssl.py in wrap_socket(self, sock, server_side, do_handshake_on_connect, suppress_ragged_eofs, server_hostname)
484 try:
–> 485 cnx.do_handshake()
486 except OpenSSL.SSL.WantReadError:

~\AppData\Local\Continuum\anaconda3\envs\zip3.6\lib\site-packages\OpenSSL\SSL.py in do_handshake(self)
1933 result = _lib.SSL_do_handshake(self._ssl)
-> 1934 self._raise_ssl_error(self._ssl, result)
1935

~\AppData\Local\Continuum\anaconda3\envs\zip3.6\lib\site-packages\OpenSSL\SSL.py in _raise_ssl_error(self, ssl, result)
1670 else:
-> 1671 _raise_current_error()
1672

~\AppData\Local\Continuum\anaconda3\envs\zip3.6\lib\site-packages\OpenSSL_util.py in exception_from_error_queue(exception_type)
53
—> 54 raise exception_type(errors)
55

Error: [(‘SSL routines’, ‘tls_process_server_certificate’, ‘certificate verify failed’)]

During handling of the above exception, another exception occurred:

SSLError Traceback (most recent call last)
~\AppData\Local\Continuum\anaconda3\envs\zip3.6\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)
671 headers=headers,
–> 672 chunked=chunked,
673 )

~\AppData\Local\Continuum\anaconda3\envs\zip3.6\lib\site-packages\urllib3\connectionpool.py in _make_request(self, conn, method, url, timeout, chunked, **httplib_request_kw)
375 try:
–> 376 self._validate_conn(conn)
377 except (SocketTimeout, BaseSSLError) as e:

~\AppData\Local\Continuum\anaconda3\envs\zip3.6\lib\site-packages\urllib3\connectionpool.py in _validate_conn(self, conn)
993 if not getattr(conn, “sock”, None): # AppEngine might not have .sock
–> 994 conn.connect()
995

~\AppData\Local\Continuum\anaconda3\envs\zip3.6\lib\site-packages\urllib3\connection.py in connect(self)
359 server_hostname=server_hostname,
–> 360 ssl_context=context,
361 )

~\AppData\Local\Continuum\anaconda3\envs\zip3.6\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, key_password)
369 if HAS_SNI and server_hostname is not None:
–> 370 return context.wrap_socket(sock, server_hostname=server_hostname)
371

~\AppData\Local\Continuum\anaconda3\envs\zip3.6\lib\site-packages\urllib3\contrib\pyopenssl.py in wrap_socket(self, sock, server_side, do_handshake_on_connect, suppress_ragged_eofs, server_hostname)
490 except OpenSSL.SSL.Error as e:
–> 491 raise ssl.SSLError(“bad handshake: %r” % e)
492 break

SSLError: (“bad handshake: Error([(‘SSL routines’, ‘tls_process_server_certificate’, ‘certificate verify failed’)],)”,)

During handling of the above exception, another exception occurred:

MaxRetryError Traceback (most recent call last)
~\AppData\Local\Continuum\anaconda3\envs\zip3.6\lib\site-packages\requests\adapters.py in send(self, request, stream, timeout, verify, cert, proxies)
448 retries=self.max_retries,
–> 449 timeout=timeout
450 )

~\AppData\Local\Continuum\anaconda3\envs\zip3.6\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)
719 retries = retries.increment(
–> 720 method, url, error=e, _pool=self, _stacktrace=sys.exc_info()[2]
721 )

~\AppData\Local\Continuum\anaconda3\envs\zip3.6\lib\site-packages\urllib3\util\retry.py in increment(self, method, url, response, error, _pool, _stacktrace)
435 if new_retry.is_exhausted():
–> 436 raise MaxRetryError(_pool, url, error or ResponseError(cause))
437

MaxRetryError: HTTPSConnectionPool(host=‘api.plot.ly’, port=443): Max retries exceeded with url: /v2/users/current (Caused by SSLError(SSLError(“bad handshake: Error([(‘SSL routines’, ‘tls_process_server_certificate’, ‘certificate verify failed’)],)”,),))

During handling of the above exception, another exception occurred:

SSLError Traceback (most recent call last)
~\AppData\Local\Continuum\anaconda3\envs\zip3.6\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:

~\AppData\Local\Continuum\anaconda3\envs\zip3.6\lib\site-packages\requests\api.py in request(method, url, **kwargs)
60 with sessions.Session() as session:
—> 61 return session.request(method=method, url=url, **kwargs)
62

~\AppData\Local\Continuum\anaconda3\envs\zip3.6\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)
529 send_kwargs.update(settings)
–> 530 resp = self.send(prep, **send_kwargs)
531

~\AppData\Local\Continuum\anaconda3\envs\zip3.6\lib\site-packages\requests\sessions.py in send(self, request, **kwargs)
642 # Send the request
–> 643 r = adapter.send(request, **kwargs)
644

~\AppData\Local\Continuum\anaconda3\envs\zip3.6\lib\site-packages\requests\adapters.py in send(self, request, stream, timeout, verify, cert, proxies)
513 # This branch is for urllib3 v1.22 and later.
–> 514 raise SSLError(e, request=request)
515

SSLError: HTTPSConnectionPool(host=‘api.plot.ly’, port=443): Max retries exceeded with url: /v2/users/current (Caused by SSLError(SSLError(“bad handshake: Error([(‘SSL routines’, ‘tls_process_server_certificate’, ‘certificate verify failed’)],)”,),))

During handling of the above exception, another exception occurred:

PlotlyRequestError Traceback (most recent call last)
~\AppData\Local\Continuum\anaconda3\envs\zip3.6\lib\site-packages\chart_studio\plotly\plotly.py in sign_in(username, api_key, **kwargs)
64 # with the given, username, api_key, and plotly_api_domain.
—> 65 v2.users.current()
66 except exceptions.PlotlyRequestError:

~\AppData\Local\Continuum\anaconda3\envs\zip3.6\lib\site-packages\chart_studio\api\v2\users.py in current()
16 url = build_url(RESOURCE, route=“current”)
—> 17 return request(“get”, url)

~\AppData\Local\Continuum\anaconda3\envs\zip3.6\lib\site-packages\retrying.py in wrapped_f(*args, **kw)
48 def wrapped_f(*args, **kw):
—> 49 return Retrying(*dargs, **dkw).call(f, *args, **kw)
50

~\AppData\Local\Continuum\anaconda3\envs\zip3.6\lib\site-packages\retrying.py in call(self, fn, *args, **kwargs)
205 if not self.should_reject(attempt):
–> 206 return attempt.get(self._wrap_exception)
207

~\AppData\Local\Continuum\anaconda3\envs\zip3.6\lib\site-packages\retrying.py in get(self, wrap_exception)
246 else:
–> 247 six.reraise(self.value[0], self.value[1], self.value[2])
248 else:

~\AppData\Local\Continuum\anaconda3\envs\zip3.6\lib\site-packages\six.py in reraise(tp, value, tb)
702 raise value.with_traceback(tb)
–> 703 raise value
704 finally:

~\AppData\Local\Continuum\anaconda3\envs\zip3.6\lib\site-packages\retrying.py in call(self, fn, *args, **kwargs)
199 try:
–> 200 attempt = Attempt(fn(*args, **kwargs), attempt_number, False)
201 except:

~\AppData\Local\Continuum\anaconda3\envs\zip3.6\lib\site-packages\chart_studio\api\v2\utils.py in request(method, url, **kwargs)
178 content = response.content if response else “No content”
–> 179 raise exceptions.PlotlyRequestError(message, status_code, content)
180 validate_response(response)

PlotlyRequestError: No message

During handling of the above exception, another exception occurred:

PlotlyError Traceback (most recent call last)
in
7
8 # auth to plotly
----> 9 py.sign_in(plotly_username, plotly_key)
10 data = [go.Histogram(x=daily_log_returns)]
11 py.iplot(data, filename=‘basic histogram’)

~\AppData\Local\Continuum\anaconda3\envs\zip3.6\lib\site-packages\chart_studio\plotly\plotly.py in sign_in(username, api_key, **kwargs)
65 v2.users.current()
66 except exceptions.PlotlyRequestError:
—> 67 raise _plotly_utils.exceptions.PlotlyError(“Sign in failed.”)
68
69

PlotlyError: Sign in failed.

Exact my problem. It’s the default port the package is using. I couldn’t solve it. Were you able to solve this issue?

no. i could not solve it. i gave up

I don’t blame you. I’m about to do the same myself.

Hi @murthysuresh, cc @ceecee

These errors are just displayed but, your plot was sent to Plotly cloud 14 hours ago: https://plotly.com/~murthysuresh/1
That’s why I suspect that they are caused by your .plotly/.config file that contains this line:

 "plotly_domain": "https://plot.ly",

Recently the plotly domain changed to “https://plotly.com” , but your local config file is an old one. Hence look for this .config file on your system, and update the above line correspondingly.