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

**URL:** <https://community.plotly.com/t/exporting-web-plot-to-python-code-in-order-to-reformat-help/3252>\
**Category:** 📊 Plotly Python\
**Created:** [February 3, 2017, 6:19am UTC](https://community.plotly.com/t/exporting-web-plot-to-python-code-in-order-to-reformat-help/3252 "2017-02-03T06:19:12Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![soonh](https://avatars.discourse-cdn.com/v4/letter/s/df788c/32.png) [@soonh](https://community.plotly.com/u/soonh)\
**Post date:** [February 3, 2017, 6:19am UTC](https://community.plotly.com/t/exporting-web-plot-to-python-code-in-order-to-reformat-help/3252/1 "2017-02-03T06:19:12Z")

</div>

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.
