You can look at some of our existing python scripts as a template for how to use the python client:
One of key things to realize with the python client is:
from truenas_api_client import Client
with Client() as c:
data = c.call(<method>, <args>)
Make use of context manager. When the block indented under with Client() as c
exits then resources are freed and socket is closed.
2 Likes