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,20 +41,27 @@ 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():
|
||||||
new_ids = []
|
new_ids = []
|
||||||
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:
|
||||||
get_process = client.v3_process_get(id=process.id)
|
try:
|
||||||
stream_id = get_process.reference
|
get_process = client.v3_process_get(id=process.id)
|
||||||
meta = get_process.metadata
|
stream_id = get_process.reference
|
||||||
state = get_process.state
|
meta = get_process.metadata
|
||||||
|
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