@@ -45,8 +45,8 @@ def verify_email_address(self, email: str) -> bool:
4545 self .logger .info (f"Email verification request sent to { email } " )
4646 return True
4747 except ClientError as e :
48- error_code = e .response [' Error' ][ ' Code' ]
49- if error_code == ' AlreadyExists' :
48+ error_code = e .response [" Error" ][ " Code" ]
49+ if error_code == " AlreadyExists" :
5050 self .logger .info (f"Email { email } is already verified" )
5151 return True
5252 else :
@@ -56,12 +56,12 @@ def verify_email_address(self, email: str) -> bool:
5656 def send_templated_email (self , to_email : str , template_name : str , template_data : Dict [str , Any ]) -> bool :
5757 """
5858 Send a templated email using SES
59-
59+
6060 Args:
6161 to_email: Recipient email address
6262 template_name: Name of the SES template
6363 template_data: Data to populate template variables
64-
64+
6565 Returns:
6666 bool: True if email sent successfully, False otherwise
6767 """
@@ -72,23 +72,25 @@ def send_templated_email(self, to_email: str, template_name: str, template_data:
7272 try :
7373 response = self .ses_client .send_templated_email (
7474 Source = self .source_email ,
75- Destination = {' ToAddresses' : [to_email ]},
75+ Destination = {" ToAddresses" : [to_email ]},
7676 Template = template_name ,
77- TemplateData = json .dumps (template_data )
77+ TemplateData = json .dumps (template_data ),
7878 )
7979
8080 self .logger .info (f"Email sent successfully to { to_email } . MessageId: { response ['MessageId' ]} " )
8181 return True
8282
8383 except ClientError as e :
84- error_code = e .response [' Error' ][ ' Code' ]
85- error_message = e .response [' Error' ][ ' Message' ]
84+ error_code = e .response [" Error" ][ " Code" ]
85+ error_message = e .response [" Error" ][ " Message" ]
8686
87- if error_code == ' MessageRejected' and ' not verified' in error_message :
87+ if error_code == " MessageRejected" and " not verified" in error_message :
8888 # Try to verify the email address automatically
8989 self .logger .info (f"Email { to_email } not verified. Attempting to verify..." )
9090 if self .verify_email_address (to_email ):
91- self .logger .info (f"Email verification request sent to { to_email } . Please check your email and verify." )
91+ self .logger .info (
92+ f"Email verification request sent to { to_email } . Please check your email and verify."
93+ )
9294 else :
9395 self .logger .error (f"Failed to send verification request for { to_email } " )
9496 return False
@@ -102,33 +104,29 @@ def send_templated_email(self, to_email: str, template_name: str, template_data:
102104 def send_verification_email (self , to_email : str , verification_link : str ) -> bool :
103105 """
104106 Send email verification email
105-
107+
106108 Args:
107109 to_email: Recipient email address
108110 verification_link: Firebase verification link
109-
111+
110112 Returns:
111113 bool: True if email sent successfully, False otherwise
112114 """
113- template_data = {
114- "verification_link" : verification_link
115- }
115+ template_data = {"verification_link" : verification_link }
116116
117117 return self .send_templated_email (to_email , "EmailVerification" , template_data )
118118
119119 def send_password_reset_email (self , to_email : str , reset_link : str ) -> bool :
120120 """
121121 Send password reset email
122-
122+
123123 Args:
124124 to_email: Recipient email address
125125 reset_link: Firebase password reset link
126-
126+
127127 Returns:
128128 bool: True if email sent successfully, False otherwise
129129 """
130- template_data = {
131- "reset_link" : reset_link
132- }
130+ template_data = {"reset_link" : reset_link }
133131
134132 return self .send_templated_email (to_email , "PasswordReset" , template_data )
0 commit comments