|
1 | | -from django.urls import re_path |
| 1 | +from django.urls import path, re_path |
2 | 2 |
|
3 | 3 | from .webhooks.amazon_ses import ( |
4 | 4 | AmazonSESInboundWebhookView, |
|
18 | 18 |
|
19 | 19 | app_name = "anymail" |
20 | 20 | urlpatterns = [ |
21 | | - re_path( |
22 | | - r"^amazon_ses/inbound/$", |
| 21 | + path( |
| 22 | + "amazon_ses/inbound/", |
23 | 23 | AmazonSESInboundWebhookView.as_view(), |
24 | 24 | name="amazon_ses_inbound_webhook", |
25 | 25 | ), |
26 | 26 | re_path( |
| 27 | + # Mailgun delivers inbound messages differently based on whether |
| 28 | + # the webhook url contains "mime" (anywhere). You can use either |
| 29 | + # ".../mailgun/inbound/" or ".../mailgun/inbound_mime/" depending |
| 30 | + # on the behavior you want. |
27 | 31 | r"^mailgun/inbound(_mime)?/$", |
28 | 32 | MailgunInboundWebhookView.as_view(), |
29 | 33 | name="mailgun_inbound_webhook", |
30 | 34 | ), |
31 | | - re_path( |
32 | | - r"^mailjet/inbound/$", |
| 35 | + path( |
| 36 | + "mailjet/inbound/", |
33 | 37 | MailjetInboundWebhookView.as_view(), |
34 | 38 | name="mailjet_inbound_webhook", |
35 | 39 | ), |
36 | | - re_path( |
37 | | - r"^postal/inbound/$", |
| 40 | + path( |
| 41 | + "postal/inbound/", |
38 | 42 | PostalInboundWebhookView.as_view(), |
39 | 43 | name="postal_inbound_webhook", |
40 | 44 | ), |
41 | | - re_path( |
42 | | - r"^postmark/inbound/$", |
| 45 | + path( |
| 46 | + "postmark/inbound/", |
43 | 47 | PostmarkInboundWebhookView.as_view(), |
44 | 48 | name="postmark_inbound_webhook", |
45 | 49 | ), |
46 | | - re_path( |
47 | | - r"^sendgrid/inbound/$", |
| 50 | + path( |
| 51 | + "sendgrid/inbound/", |
48 | 52 | SendGridInboundWebhookView.as_view(), |
49 | 53 | name="sendgrid_inbound_webhook", |
50 | 54 | ), |
51 | | - re_path( |
52 | | - r"^sparkpost/inbound/$", |
| 55 | + path( |
| 56 | + "sparkpost/inbound/", |
53 | 57 | SparkPostInboundWebhookView.as_view(), |
54 | 58 | name="sparkpost_inbound_webhook", |
55 | 59 | ), |
56 | | - re_path( |
57 | | - r"^amazon_ses/tracking/$", |
| 60 | + path( |
| 61 | + "amazon_ses/tracking/", |
58 | 62 | AmazonSESTrackingWebhookView.as_view(), |
59 | 63 | name="amazon_ses_tracking_webhook", |
60 | 64 | ), |
61 | | - re_path( |
62 | | - r"^mailgun/tracking/$", |
| 65 | + path( |
| 66 | + "mailgun/tracking/", |
63 | 67 | MailgunTrackingWebhookView.as_view(), |
64 | 68 | name="mailgun_tracking_webhook", |
65 | 69 | ), |
66 | | - re_path( |
67 | | - r"^mailjet/tracking/$", |
| 70 | + path( |
| 71 | + "mailjet/tracking/", |
68 | 72 | MailjetTrackingWebhookView.as_view(), |
69 | 73 | name="mailjet_tracking_webhook", |
70 | 74 | ), |
71 | | - re_path( |
72 | | - r"^postal/tracking/$", |
| 75 | + path( |
| 76 | + "postal/tracking/", |
73 | 77 | PostalTrackingWebhookView.as_view(), |
74 | 78 | name="postal_tracking_webhook", |
75 | 79 | ), |
76 | | - re_path( |
77 | | - r"^postmark/tracking/$", |
| 80 | + path( |
| 81 | + "postmark/tracking/", |
78 | 82 | PostmarkTrackingWebhookView.as_view(), |
79 | 83 | name="postmark_tracking_webhook", |
80 | 84 | ), |
81 | | - re_path( |
82 | | - r"^sendgrid/tracking/$", |
| 85 | + path( |
| 86 | + "sendgrid/tracking/", |
83 | 87 | SendGridTrackingWebhookView.as_view(), |
84 | 88 | name="sendgrid_tracking_webhook", |
85 | 89 | ), |
86 | | - re_path( |
87 | | - r"^sendinblue/tracking/$", |
| 90 | + path( |
| 91 | + "sendinblue/tracking/", |
88 | 92 | SendinBlueTrackingWebhookView.as_view(), |
89 | 93 | name="sendinblue_tracking_webhook", |
90 | 94 | ), |
91 | | - re_path( |
92 | | - r"^sparkpost/tracking/$", |
| 95 | + path( |
| 96 | + "sparkpost/tracking/", |
93 | 97 | SparkPostTrackingWebhookView.as_view(), |
94 | 98 | name="sparkpost_tracking_webhook", |
95 | 99 | ), |
96 | 100 | # Anymail uses a combined Mandrill webhook endpoint, |
97 | 101 | # to simplify Mandrill's key-validation scheme: |
98 | | - re_path( |
99 | | - r"^mandrill/$", MandrillCombinedWebhookView.as_view(), name="mandrill_webhook" |
100 | | - ), |
| 102 | + path("mandrill/", MandrillCombinedWebhookView.as_view(), name="mandrill_webhook"), |
101 | 103 | # This url is maintained for backwards compatibility with earlier Anymail releases: |
102 | | - re_path( |
103 | | - r"^mandrill/tracking/$", |
| 104 | + path( |
| 105 | + "mandrill/tracking/", |
104 | 106 | MandrillCombinedWebhookView.as_view(), |
105 | 107 | name="mandrill_tracking_webhook", |
106 | 108 | ), |
|
0 commit comments