-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
check that share key is enabled #726
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1295,9 +1295,9 @@ def parse_grid_id_args(grid, grid_url): | |
return grid.id | ||
|
||
|
||
def add_share_key_to_url(plot_url): | ||
def add_share_key_to_url(plot_url, attempt=0): | ||
""" | ||
Update plot's url to include the secret key | ||
Check that share key is enabled and update url to include the secret key | ||
|
||
""" | ||
urlsplit = six.moves.urllib.parse.urlparse(plot_url) | ||
|
@@ -1308,7 +1308,14 @@ def add_share_key_to_url(plot_url): | |
body = {'share_key_enabled': True, 'world_readable': False} | ||
response = v2.files.update(fid, body) | ||
|
||
return plot_url + '?share_key=' + response.json()['share_key'] | ||
if not v2.files.retrieve(fid).json()['share_key_enabled']: | ||
attempt += 1 | ||
if attempt == 10: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd be OK with bumping this up to 50 even There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 bumped to 50 |
||
raise Exception | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We're trying to wrap everything in plotly exceptions so that users can catch them. So just: |
||
add_share_key_to_url(plot_url, attempt) | ||
|
||
url_share_key = plot_url + '?share_key=' + response.json()['share_key'] | ||
return url_share_key | ||
|
||
|
||
def _send_to_plotly(figure, **plot_options): | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd add a comment here about why we're trying multiple times