Hi there,
Create a service account (ie in the local user store on your TACACS server (ACS or ISE) ) and ensure it only has 'priv 1' access.
Have your script run the command:
test aaa group tacacs+ <service_acc_name> <service_acc_pass> new-code
...then regex the returned result for the string "User successfully authenticated"
cheers,
Seb.