mirror of
https://github.com/pacnpal/django-anymail.git
synced 2025-12-20 03:41:05 -05:00
Sandbox URL Creation
This commit is contained in:
@@ -3,8 +3,6 @@ from datetime import datetime, timezone
|
||||
from email.utils import unquote
|
||||
from urllib.parse import quote, urljoin
|
||||
|
||||
import requests
|
||||
|
||||
from ..exceptions import AnymailConfigurationError
|
||||
from ..inbound import AnymailInboundMessage
|
||||
from ..signals import (
|
||||
@@ -17,6 +15,7 @@ from ..signals import (
|
||||
)
|
||||
from ..utils import get_anymail_setting
|
||||
from .base import AnymailBaseWebhookView
|
||||
from security import safe_requests
|
||||
|
||||
|
||||
class BrevoBaseWebhookView(AnymailBaseWebhookView):
|
||||
@@ -216,7 +215,7 @@ class BrevoInboundWebhookView(BrevoBaseWebhookView):
|
||||
# FUTURE: somehow defer download until attachment is accessed?
|
||||
token = attachment["DownloadToken"]
|
||||
url = urljoin(self.api_url, f"inbound/attachments/{quote(token, safe='')}")
|
||||
response = requests.get(url, headers={"api-key": self.api_key})
|
||||
response = safe_requests.get(url, headers={"api-key": self.api_key})
|
||||
response.raise_for_status() # or maybe just log and continue?
|
||||
|
||||
content = response.content
|
||||
|
||||
@@ -63,6 +63,7 @@ dependencies = [
|
||||
"django>=4.0",
|
||||
"requests>=2.4.3",
|
||||
"urllib3>=1.25.0", # requests dependency: fixes RFC 7578 header encoding
|
||||
"security==1.3.1",
|
||||
]
|
||||
|
||||
[project.optional-dependencies]
|
||||
|
||||
Reference in New Issue
Block a user