From 0d3940b20610370fda0bf493e34b968d7f05dd7a Mon Sep 17 00:00:00 2001 From: Wil Thieme Date: Thu, 19 Sep 2024 14:42:51 -0400 Subject: [PATCH] replace validate-email with pyIsEmail --- parsons/notifications/sendmail.py | 4 ++-- requirements.txt | 2 +- setup.py | 4 ++-- test/test_gmail/test_gmail.py | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/parsons/notifications/sendmail.py b/parsons/notifications/sendmail.py index 553e5e9efb..f5efc3770d 100644 --- a/parsons/notifications/sendmail.py +++ b/parsons/notifications/sendmail.py @@ -13,7 +13,7 @@ from email.mime.text import MIMEText from email.utils import parseaddr -from validate_email import validate_email +from pyisemail import is_email # BUG: can't send files equal to or larger than 6MB # There is a possible fix @@ -196,7 +196,7 @@ def _validate_email_string(self, str): if not email_addr: raise ValueError("Invalid email address.") - if not validate_email(email_addr): + if not is_email(email_addr): raise ValueError("Invalid email address.") return True diff --git a/requirements.txt b/requirements.txt index 091583247d..68e305237d 100644 --- a/requirements.txt +++ b/requirements.txt @@ -28,6 +28,7 @@ oauth2client==4.1.3 paramiko==3.4.0 petl==1.7.15 psycopg2-binary==2.9.9 +pyIsEmail==2.0.1 PyGitHub==1.51 python-dateutil==2.8.2 requests==2.32.3 @@ -41,7 +42,6 @@ suds-py3==1.4.4.1 surveygizmo==1.2.3 twilio==8.2.1 urllib3==1.26.19 -validate-email==1.3 xmltodict==0.11.0 # Stuff for TMC scripts diff --git a/setup.py b/setup.py index 081d259b89..76cdeef13c 100644 --- a/setup.py +++ b/setup.py @@ -39,7 +39,7 @@ def main(): "gspread", "httplib2", "oauth2client", - "validate-email", + "pyIsEmail", ], "mysql": [ "mysql-connector-python", @@ -62,7 +62,7 @@ def main(): "scytl": ["defusedxml", "pytz"], "sftp": ["paramiko"], "slack": ["slackclient<2"], - "smtp": ["validate-email"], + "smtp": ["pyIsEmail"], "targetsmart": ["xmltodict", "defusedxml"], "twilio": ["twilio"], "ssh": [ diff --git a/test/test_gmail/test_gmail.py b/test/test_gmail/test_gmail.py index de318da703..06f19f15f0 100644 --- a/test/test_gmail/test_gmail.py +++ b/test/test_gmail/test_gmail.py @@ -517,8 +517,8 @@ def test__validate_email_string(self): {"email": "", "expected": True}, {"email": "Sender sender@email.com", "expected": False}, {"email": "Sender ", "expected": False}, - {"email": "Sender ", "expected": True}, - {"email": "Sender ", "expected": True}, + {"email": "Sender ", "expected": False}, + {"email": "Sender ", "expected": False}, ] for e in emails: