#NEWLINE# def setup( self ) : #NEWLINE# #INDENT# self . host = self . _config [ 'webhook' ] [ 'host' ] #NEWLINE# self . port = self . _config [ 'webhook' ] [ 'port' ] #NEWLINE# path = self . _config [ 'webhook' ] [ 'path' ] #NEWLINE# route = '/{}/{}' . format ( path , '<string:action>' ) #NEWLINE# self . app = Flask ( __name__ ) #NEWLINE# self . log = self . _sensor_service . get_logger ( __name__ ) #NEWLINE# @ self . app . route ( '/status' ) #NEWLINE# def status( ) : #NEWLINE# #INDENT# return json . dumps ( { #NEWLINE# #INDENT# 'response' : 'OK' , #NEWLINE# #UNINDENT# } ) #NEWLINE# #UNINDENT# @ self . app . route ( route , methods = [ 'POST' ] ) #NEWLINE# def ac_events( action ) : #NEWLINE# #INDENT# payload = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# payload [ 'headers' ] = self . _get_headers_as_dict ( request . headers ) #NEWLINE# payload [ 'body' ] = request . form . to_dict ( flat = True ) #NEWLINE# payload [ 'action' ] = action #NEWLINE# self . _sensor_service . dispatch ( WEBHOOK_TRIGGER_REF , payload ) #NEWLINE# return json . dumps ( { #NEWLINE# #INDENT# 'response' : 'triggerposted' , #NEWLINE# #UNINDENT# } )