@@ -1493,6 +1493,42 @@ def get_grid(grid_url, raw=False):
14931493 return json_res
14941494
14951495
1496+ def create_animations (figure , filename = None , sharing = 'public' ):
1497+ """
1498+ Put description here.
1499+
1500+ For parameter descriptions, see the doc string for `py.plot()`.
1501+ `private` is not supported currently for param 'sharing'. Returns the
1502+ url for the plot if response is ok.
1503+ """
1504+ credentials = get_credentials ()
1505+ validate_credentials (credentials )
1506+ username , api_key = credentials ['username' ], credentials ['api_key' ]
1507+ auth = HTTPBasicAuth (str (username ), str (api_key ))
1508+ headers = {'Plotly-Client-Platform' : 'python' }
1509+
1510+ json = {
1511+ 'figure' : figure ,
1512+ 'world_readable' : 'true'
1513+ }
1514+
1515+ # set filename if specified
1516+ if filename :
1517+ json ['filename' ] = filename
1518+
1519+ # set sharing
1520+ if sharing == 'public' :
1521+ json ['world_readable' ] = 'true'
1522+ elif sharing == 'private' :
1523+ json ['world_readable' ] = 'false'
1524+
1525+ api_url = _api_v2 .api_url ('plots' )
1526+ r = requests .post (api_url , auth = auth , headers = headers , json = json )
1527+
1528+ json_r = json .loads (r .text )
1529+ return json_r ['file' ]['web_url' ]
1530+
1531+
14961532def _open_url (url ):
14971533 try :
14981534 from webbrowser import open as wbopen
0 commit comments