Closed gyterpena closed 7 months ago
Hello
I'm getting following error while sending emails, after python upgrade to 3.12
Uncaught exception running rule WebLogs_spike.yaml: SMTP.starttls() got an unexpected keyword argument 'keyfile'
[Traceback (most recent call last):, File "/usr/local/lib/python3.12/site-packages/elastalert/elastalert.py", line 1306, in alert, return self.send_alert(matches, rule, alert_time=alert_time, retried=retried), ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^, File "/usr/local/lib/python3.12/site-packages/elastalert/elastalert.py", line 1391, in send_alert, alert.alert(matches), File "/usr/local/lib/python3.12/site-packages/elastalert/alerters/email.py", line 108, in alert, self.smtp.starttls(keyfile=self.smtp_key_file, certfile=self.smtp_cert_file), TypeError: SMTP.starttls() got an unexpected keyword argument 'keyfile'
Looks like 3.12 deprecated keyfile
https://docs.python.org/3/library/smtplib.html#smtplib.SMTP_SSL
https://stackoverflow.com/questions/77482831/smtp-starttls-got-an-unexpected-keyword-argument-keyfile
https://docs.python.org/3/library/smtplib.html#smtplib.SMTP.starttls
Submitting changes You're all welcome to submit a pull request.
Hello
I'm getting following error while sending emails, after python upgrade to 3.12
Uncaught exception running rule WebLogs_spike.yaml: SMTP.starttls() got an unexpected keyword argument 'keyfile'
[Traceback (most recent call last):, File "/usr/local/lib/python3.12/site-packages/elastalert/elastalert.py", line 1306, in alert, return self.send_alert(matches, rule, alert_time=alert_time, retried=retried), ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^, File "/usr/local/lib/python3.12/site-packages/elastalert/elastalert.py", line 1391, in send_alert, alert.alert(matches), File "/usr/local/lib/python3.12/site-packages/elastalert/alerters/email.py", line 108, in alert, self.smtp.starttls(keyfile=self.smtp_key_file, certfile=self.smtp_cert_file), TypeError: SMTP.starttls() got an unexpected keyword argument 'keyfile'
Looks like 3.12 deprecated keyfile
https://docs.python.org/3/library/smtplib.html#smtplib.SMTP_SSL