def verify_hook_signature(node_settings, data, headers):
 if (node_settings.hook_secret is None):
  raise HookError('No secret key')
 digest = hmac.new(str(node_settings.hook_secret), data, digestmod=hashlib.sha1).hexdigest()
 signature = headers.get(HOOK_SIGNATURE_KEY, '').replace('sha1=', '')
 if (digest != signature):
  raise HookError('Invalid signature')

def verify_hook_signature ( node_settings , data , headers ) : if ( node_settings . hook_secret is None ) : raise HookError ( 'No secret key' ) digest = hmac . new ( str ( node_settings . hook_secret ) , data , digestmod = hashlib . sha1 ) . hexdigest ( ) signature = headers . get ( HOOK_SIGNATURE_KEY , '' ) . replace ( 'sha1=' , '' ) if ( digest != signature ) : raise HookError ( 'Invalid signature' )
verify hook signature .