1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

Webhook signal refactor - fixes #2282 (#2260)

Refactor of webhook signaling system to use the same middleware mechanics of Changelogging
This commit is contained in:
John Anderson
2018-07-30 14:23:49 -04:00
committed by Jeremy Stretch
parent 9876a2efcd
commit 722d0d5554
17 changed files with 65 additions and 192 deletions

View File

@ -4,7 +4,7 @@ import hmac
import requests
from django_rq import job
from extras.constants import WEBHOOK_CT_JSON, WEBHOOK_CT_X_WWW_FORM_ENCODED
from extras.constants import WEBHOOK_CT_JSON, WEBHOOK_CT_X_WWW_FORM_ENCODED, OBJECTCHANGE_ACTION_CHOICES
@job('default')
@ -13,7 +13,7 @@ def process_webhook(webhook, data, model_class, event, timestamp):
Make a POST request to the defined Webhook
"""
payload = {
'event': event,
'event': dict(OBJECTCHANGE_ACTION_CHOICES)[event],
'timestamp': timestamp,
'model': model_class.__name__,
'data': data