Deleting a grid through python

I followed this example ( to delete a plot

First I created the plot with this command:

url = py.plot({“data”: [{“x”: [1, 2, 3],
“y”: [4, 2, 4]}],
“layout”: {“title”: “Let’s Trash This Plot
(then restore it)”}},
filename=‘trash example’)

and then the url had a number at the end (in this case 6) so I set fid to be:

fid = username+’:6’

and then deleted the plot with this command:‘’+fid+’/trash’, auth=auth, headers=headers)

That worked, and I also wanted to delete the grid that was created alongside the plot. I noticed the grid had 7 at the end of it’s url so I could delete it with the same command as above except using

fid = username+’:7’

However I wasn’t sure this was the best way. Is there a way to know for sure what the # of the grid file that was created was before deleting it.

My reason for asking this is that I wanted to have a web site that would generate a different grid+plot depending on the user input. But I also wanted a way to remove that users plot so they don’t just build up over time. I am not sure the best way to go about this, and if I can rely on the +1 grid id. I am also not 100% sure this idea of having users generate new plots is really using the API in the right way so any advice about that would be appreciated, thanks.

1 Like