Properly encode path components used to construct API URLs

Resolves #144 and similar potential issues
This commit is contained in:
medmunds
2019-02-23 15:27:41 -08:00
parent 578bad9a57
commit dabbdad3bd
4 changed files with 18 additions and 8 deletions

View File

@@ -1,4 +1,5 @@
from requests.structures import CaseInsensitiveDict
from six.moves.urllib.parse import quote
from .base_requests import AnymailRequestsBackend, RequestsPayload
from ..exceptions import AnymailRequestsAPIError
@@ -76,7 +77,7 @@ class SendinBluePayload(RequestsPayload):
def get_api_endpoint(self):
if self.template_id:
return "smtp/templates/%s/send" % self.template_id
return "smtp/templates/%s/send" % quote(str(self.template_id), safe='')
else:
return "smtp/email"