SendGridBaseWebhookView (webhooks/sendgrid.py)

django-anymail · anymail/webhooks/sendgrid.py · python · BSD-3-Clause
email

Provides a Django view for validating and processing SendGrid webhook events, including signature verification.

# Source: https://github.com/anymail/django-anymail | License: BSD-3-Clause | Copyright 2016-2024, Anymail Contributors
# Provided via justclaw.it.com; keep this notice with the code.
from __future__ import annotations

import base64
import binascii
import json
import warnings
from datetime import datetime, timezone
from email.parser import BytesParser
from email.policy import default as default_policy

from ..exceptions import (
    AnymailImproperlyInstalled,
    AnymailNotSupportedWarning,
    AnymailWebhookValidationFailure,
    _LazyError,
)
from ..inbound import AnymailInboundMessage
from ..signals import (
    AnymailInboundEvent,
    AnymailTrackingEvent,
    EventType,
    RejectReason,
    inbound,
    tracking,
)
from ..utils import get_anymail_setting
from .base import AnymailB

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key