2 years ago
Python SDK hangs with no output
I have a simple query script that looks for GroupID values. It’s really as simple as:
api = logicmonitor_sdk.LMApi(logicmonitor_sdk.ApiClient(configuration))
search=sys.argv[1]
try:
api_response = api.get_device_group_list(filter=f"name~\"{search}\"||customProperties~\"{search}\"")
for d in api_response.items:
print(f"{d.id}:{d.full_path}")
except ApiException as e:
print("Exception when calling LMApi->getAlertList: %s\n" % e)
I call the script from the CLI with something like:
./query_group.py “Some Detail”
What I’ve noticed at times is that the script will just sit there (I’ve left it going for over 10 minutes) and it doesn’t seem to respond back any error or output. So I have to kill it with CTRL + C.
I was wondering if there is a way in the SDK configuration to set a maximum wait time before an error/exception would be produced, thus ending the script?