|
@@ -461,12 +461,15 @@ async def getCEL(start=None, end=None, table='cel', field='eventtime', sort='id'
|
|
|
|
|
|
|
|
async def doCallback(entity, msg):
|
|
async def doCallback(entity, msg):
|
|
|
row = await db.fetch_one(query='SELECT url FROM callback_urls WHERE device = :device', values={'device': entity})
|
|
row = await db.fetch_one(query='SELECT url FROM callback_urls WHERE device = :device', values={'device': entity})
|
|
|
- if (row is not None) and (row['url'].startswith('http')):
|
|
|
|
|
|
|
+ if ((row is not None) and (row['url'].startswith('http')) and ('blackhole' not in row['url'])):
|
|
|
app.logger.warning(f'''POST {row['url']} data: {str(msg)}''')
|
|
app.logger.warning(f'''POST {row['url']} data: {str(msg)}''')
|
|
|
if not 'HTTP_CLIENT' in app.config:
|
|
if not 'HTTP_CLIENT' in app.config:
|
|
|
await initHttpClient()
|
|
await initHttpClient()
|
|
|
- reply = await app.config['HTTP_CLIENT'].post(row['url'], json=msg)
|
|
|
|
|
- return reply
|
|
|
|
|
|
|
+ try:
|
|
|
|
|
+ reply = await app.config['HTTP_CLIENT'].post(row['url'], json=msg)
|
|
|
|
|
+ return reply
|
|
|
|
|
+ except Exception as e:
|
|
|
|
|
+ app.logger.warning('callback error {}'.format(row['url']))
|
|
|
else:
|
|
else:
|
|
|
app.logger.warning('No callback url defined for {}'.format(entity))
|
|
app.logger.warning('No callback url defined for {}'.format(entity))
|
|
|
return None
|
|
return None
|