handle exception of the client function
This commit is contained in:
parent
e2c5eaf2e5
commit
e65139ce82
1 changed files with 13 additions and 6 deletions
|
@ -41,6 +41,7 @@ try:
|
||||||
logger.info('Logging in to Datarhei Core API ' + api_username + '@' + api_hostname)
|
logger.info('Logging in to Datarhei Core API ' + api_username + '@' + api_hostname)
|
||||||
client.login()
|
client.login()
|
||||||
except Exception as err:
|
except Exception as err:
|
||||||
|
logger.error('client login error'
|
||||||
logger.error(err)
|
logger.error(err)
|
||||||
|
|
||||||
def core_api_sync():
|
def core_api_sync():
|
||||||
|
@ -48,13 +49,19 @@ def core_api_sync():
|
||||||
try:
|
try:
|
||||||
process_list = client.v3_process_get_list()
|
process_list = client.v3_process_get_list()
|
||||||
except Exception as err:
|
except Exception as err:
|
||||||
logger.error('process_get_list error')
|
logger.error('client.v3_process_get_list error')
|
||||||
|
logger.error(err)
|
||||||
return True
|
return True
|
||||||
for process in process_list:
|
for process in process_list:
|
||||||
|
try:
|
||||||
get_process = client.v3_process_get(id=process.id)
|
get_process = client.v3_process_get(id=process.id)
|
||||||
stream_id = get_process.reference
|
stream_id = get_process.reference
|
||||||
meta = get_process.metadata
|
meta = get_process.metadata
|
||||||
state = get_process.state
|
state = get_process.state
|
||||||
|
except Exception as err:
|
||||||
|
logger.error('client.v3_process_get error')
|
||||||
|
logger.error(err)
|
||||||
|
continue
|
||||||
if meta is None:
|
if meta is None:
|
||||||
# Skip processes without metadata
|
# Skip processes without metadata
|
||||||
continue
|
continue
|
||||||
|
|
Loading…
Reference in a new issue