Black Lives Matter. Please consider donating to Black Girls Code today.
Dash Enterprise delivers an incredible 21x cost savings 💸Download the e-book!

Exporting web plot to python code in order to reformat - help!

I’m trying to export a plot made through the web-based tools into python code in order to fine tune the formatting settings of the plot. After exporting the code into a file, and then attempting to run the code via python 3.6 is giving me a bunch of authentication errors, even though I have confirmed I can publish novel plots within the python environment.

Any ideas? I’m getting the following errors (running this on OS X: python3 installed via homebrew on my machine). Is this the best way to do what I’m trying to do? Thanks!!!

Traceback (most recent call last):
File “/usr/local/lib/python3.6/site-packages/plotly/plotly/plotly.py”, line 56, in sign_in
v2.users.current()
File “/usr/local/lib/python3.6/site-packages/plotly/api/v2/users.py”, line 17, in current
return request(‘get’, url)
File “/usr/local/lib/python3.6/site-packages/plotly/api/v2/utils.py”, line 153, in request
validate_response(response)
File “/usr/local/lib/python3.6/site-packages/plotly/api/v2/utils.py”, line 79, in validate_response
raise exceptions.PlotlyRequestError(message, status_code, content)
plotly.exceptions.PlotlyRequestError: Bad API key

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/Users/soon/Downloads/6.py”, line 17, in
py.sign_in(‘username’, ‘api_key’)
File “/usr/local/lib/python3.6/site-packages/plotly/plotly/plotly.py”, line 58, in sign_in
raise exceptions.PlotlyError(‘Sign in failed.’)
plotly.exceptions.PlotlyError: Sign in failed.
Soons-MacBook-Air:Library soon$ python3 /Users/soon/Downloads/6.py
Traceback (most recent call last):
File “/usr/local/lib/python3.6/site-packages/plotly/plotly/plotly.py”, line 56, in sign_in
v2.users.current()
File “/usr/local/lib/python3.6/site-packages/plotly/api/v2/users.py”, line 17, in current
return request(‘get’, url)
File “/usr/local/lib/python3.6/site-packages/plotly/api/v2/utils.py”, line 153, in request
validate_response(response)
File “/usr/local/lib/python3.6/site-packages/plotly/api/v2/utils.py”, line 79, in validate_response
raise exceptions.PlotlyRequestError(message, status_code, content)
plotly.exceptions.PlotlyRequestError: Bad API key

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/Users/soon/Downloads/6.py”, line 17, in
py.sign_in(‘username’, ‘api_key’)
File “/usr/local/lib/python3.6/site-packages/plotly/plotly/plotly.py”, line 58, in sign_in
raise exceptions.PlotlyError(‘Sign in failed.’)
plotly.exceptions.PlotlyError: Sign in failed.