From 52d19bd0ee8845649b4a0857ada4a9e04c64916f Mon Sep 17 00:00:00 2001 From: Nicholas Mei Date: Thu, 29 Aug 2024 12:11:45 -0700 Subject: [PATCH] Relax typing for email function in ses.py utils Alow addresses to be either a str or the EmailAddress ValidatedStr class --- src/aibs_informatics_aws_utils/ses.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/aibs_informatics_aws_utils/ses.py b/src/aibs_informatics_aws_utils/ses.py index bee3f08..f4909e3 100644 --- a/src/aibs_informatics_aws_utils/ses.py +++ b/src/aibs_informatics_aws_utils/ses.py @@ -4,7 +4,7 @@ from email.mime.nonmultipart import MIMENonMultipart from email.mime.text import MIMEText from pathlib import Path -from typing import TYPE_CHECKING, Any, Dict, List, Optional, Sequence +from typing import TYPE_CHECKING, Any, Dict, List, Optional, Sequence, Union from aibs_informatics_core.models.email_address import EmailAddress from botocore.exceptions import ClientError @@ -90,8 +90,8 @@ def send_email(request: SendEmailRequestRequestTypeDef) -> SendEmailResponseType def send_simple_email( - source: EmailAddress, - to_addresses: Sequence[EmailAddress], + source: Union[str, EmailAddress], + to_addresses: Sequence[Union[str, EmailAddress]], subject: str, body: str = "", ) -> SendEmailResponseTypeDef: @@ -118,8 +118,8 @@ def send_raw_email(request: SendRawEmailRequestRequestTypeDef) -> SendRawEmailRe def send_email_with_attachment( - source: EmailAddress, - to_addresses: Sequence[EmailAddress], + source: Union[str, EmailAddress], + to_addresses: Sequence[Union[str, EmailAddress]], subject: str, body: str = "", attachments_paths: Optional[List[Path]] = None,