Terminating cluster programmatically

MichaelO
New Contributor III

Is there any python script that allows me to terminate (not delete)  a cluster in the notebook, similar to this R equivalent of

terminate_cluster(cluster_id, workspace, token = NULL, verbose = T, ...)

bdfrase
New Contributor II

Is there a way to do this without sending putting the plain text token in the code?  The API is rejecting tokens stored in secrets with a compatibility error.