File tree 1 file changed +10
-3
lines changed
1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -1295,9 +1295,9 @@ def parse_grid_id_args(grid, grid_url):
1295
1295
return grid .id
1296
1296
1297
1297
1298
- def add_share_key_to_url (plot_url ):
1298
+ def add_share_key_to_url (plot_url , attempt = 0 ):
1299
1299
"""
1300
- Update plot's url to include the secret key
1300
+ Check that share key is enabled and update url to include the secret key
1301
1301
1302
1302
"""
1303
1303
urlsplit = six .moves .urllib .parse .urlparse (plot_url )
@@ -1308,7 +1308,14 @@ def add_share_key_to_url(plot_url):
1308
1308
body = {'share_key_enabled' : True , 'world_readable' : False }
1309
1309
response = v2 .files .update (fid , body )
1310
1310
1311
- return plot_url + '?share_key=' + response .json ()['share_key' ]
1311
+ if not v2 .files .retrieve (fid ).json ()['share_key_enabled' ]:
1312
+ attempt += 1
1313
+ if attempt == 10 :
1314
+ raise Exception
1315
+ add_share_key_to_url (plot_url , attempt )
1316
+
1317
+ url_share_key = plot_url + '?share_key=' + response .json ()['share_key' ]
1318
+ return url_share_key
1312
1319
1313
1320
1314
1321
def _send_to_plotly (figure , ** plot_options ):
You can’t perform that action at this time.
0 commit comments