18 lines
438 B
Python
18 lines
438 B
Python
import json
|
|
import logging
|
|
|
|
from background_task import background
|
|
from background_task.tasks import TaskSchedule
|
|
|
|
import bid_api.models
|
|
|
|
|
|
logger = logging.getLogger(__name__)
|
|
|
|
|
|
@background(schedule={'action': TaskSchedule.RESCHEDULE_EXISTING})
|
|
def webhook_send(webhook_id: int, data: dict):
|
|
webhook = bid_api.models.Webhook.objects.get(pk=webhook_id)
|
|
payload = json.dumps(data, sort_keys=True).encode()
|
|
webhook.send(payload)
|