def from_request(cls, request, *, webhook_endpoint: WebhookEndpoint):
        """
        Create, validate and process a WebhookEventTrigger given a Django
        request object.

        The process is three-fold:
        1. Create a WebhookEventTrigger object from a Django request.
        2. Validate the WebhookEventTrigger as a Stripe event using the API.
        3. If valid, process it into an Event object (and child resource).
        """

        try:
            body = request.body.decode(request.encoding or "utf-8")
        except Exception:
            body = "(error decoding body)"

        ip = get_remote_ip(request)

        try:
            data = json.loads(body)
        except json.JSONDecodeError:
            data = {}

        stripe_account = StripeModel._find_owner_account(data=data)
        secret = webhook_endpoint.secret

        obj = cls.objects.create(
            headers=dict(request.headers),
            body=body,
            remote_ip=ip,
            stripe_trigger_account=stripe_account,
            webhook_endpoint=webhook_endpoint,
        )
        api_key = (
            stripe_account.default_api_key
            or djstripe_settings.get_default_api_key(obj.livemode)
        )

        try:
            # Validate the webhook first
            signals.webhook_pre_validate.send(sender=cls, instance=obj)

            # Default to per Webhook Endpoint Tolerance
            obj.valid = obj.validate(
                secret=secret,
                api_key=api_key,
            )

            # send post webhook validate signal
            signals.webhook_post_validate.send(
                sender=cls, instance=obj, valid=obj.valid
            )

            if obj.valid:
                signals.webhook_pre_process.send(sender=cls, instance=obj)

                # todo this should be moved to per webhook endpoint callback
                if djstripe_settings.WEBHOOK_EVENT_CALLBACK:
                    # If WEBHOOK_EVENT_CALLBACK, pass it for processing
                    djstripe_settings.WEBHOOK_EVENT_CALLBACK(obj, api_key=api_key)
                else:
                    # Process the item (do not save it, it'll get saved below)
                    obj.process(save=False, api_key=api_key)
                signals.webhook_post_process.send(
                    sender=cls, instance=obj, api_key=api_key
                )
        except Exception as e:
            max_length = cls._meta.get_field("exception").max_length
            obj.exception = str(e)[:max_length]
            obj.traceback = format_exc()

            # Send the exception as the webhook_processing_error signal
            signals.webhook_processing_error.send(
                sender=cls,
                instance=obj,
                api_key=api_key,
                exception=e,
                data=getattr(e, "http_body", ""),
            )

            # re-raise the exception so Django sees it
            raise e
        finally:
            obj.save()

        return obj

        Create, validate and process a WebhookEventTrigger given a Django
        request object.

        The process is three-fold:
        1. Create a WebhookEventTrigger object from a Django request.
        2. Validate the WebhookEventTrigger as a Stripe event using the API.
        3. If valid, process it into an Event object (and child resource).
        
djstripe/models/webhooks.py