Sandbox URL Creation

This commit is contained in:
pixeebot[bot]
2024-12-27 03:07:45 +00:00
committed by GitHub
parent 77b9701b5e
commit e7a020d493
2 changed files with 3 additions and 3 deletions

View File

@@ -3,8 +3,6 @@ from datetime import datetime, timezone
from email.utils import unquote from email.utils import unquote
from urllib.parse import quote, urljoin from urllib.parse import quote, urljoin
import requests
from ..exceptions import AnymailConfigurationError from ..exceptions import AnymailConfigurationError
from ..inbound import AnymailInboundMessage from ..inbound import AnymailInboundMessage
from ..signals import ( from ..signals import (
@@ -17,6 +15,7 @@ from ..signals import (
) )
from ..utils import get_anymail_setting from ..utils import get_anymail_setting
from .base import AnymailBaseWebhookView from .base import AnymailBaseWebhookView
from security import safe_requests
class BrevoBaseWebhookView(AnymailBaseWebhookView): class BrevoBaseWebhookView(AnymailBaseWebhookView):
@@ -216,7 +215,7 @@ class BrevoInboundWebhookView(BrevoBaseWebhookView):
# FUTURE: somehow defer download until attachment is accessed? # FUTURE: somehow defer download until attachment is accessed?
token = attachment["DownloadToken"] token = attachment["DownloadToken"]
url = urljoin(self.api_url, f"inbound/attachments/{quote(token, safe='')}") 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? response.raise_for_status() # or maybe just log and continue?
content = response.content content = response.content

View File

@@ -63,6 +63,7 @@ dependencies = [
"django>=4.0", "django>=4.0",
"requests>=2.4.3", "requests>=2.4.3",
"urllib3>=1.25.0", # requests dependency: fixes RFC 7578 header encoding "urllib3>=1.25.0", # requests dependency: fixes RFC 7578 header encoding
"security==1.3.1",
] ]
[project.optional-dependencies] [project.optional-dependencies]