Skip to content

temporary share key fix #814

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 9, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions plotly/plotly/plotly.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import copy
import json
import os
import time
import warnings
import webbrowser

Expand Down Expand Up @@ -1304,17 +1305,19 @@ def add_share_key_to_url(plot_url, attempt=0):
username = urlsplit.path.split('/')[1].split('~')[1]
idlocal = urlsplit.path.split('/')[2]
fid = '{}:{}'.format(username, idlocal)

body = {'share_key_enabled': True, 'world_readable': False}
response = v2.files.update(fid, body)

# Sometimes a share key is added, but access is still denied.
# Check that share_key_enabled is set to true and
# retry if this is not the case
# https://github.com/plotly/streambed/issues/4089
if not v2.files.retrieve(fid).json()['share_key_enabled']:
time.sleep(4)
share_key_enabled = v2.files.retrieve(fid).json()['share_key_enabled']
if not share_key_enabled:
attempt += 1
if attempt == 50:
print('Raising exception')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚡️ this print statement

raise exceptions.PlotlyError(
"The sharekey could not be enabled at this time so the graph "
"is saved as private. Try again to save as 'secret' later."
Expand Down
2 changes: 1 addition & 1 deletion plotly/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '2.0.13'
__version__ = '2.0.14'