Skip to content

Commit

Permalink
email-validator - tested with …
Browse files Browse the repository at this point in the history
 - 1.3.1
 + 2.0.0.post2
 + 2.1.0.post1
  • Loading branch information
commonism committed Nov 14, 2023
1 parent b0fe376 commit 90f49f8
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions pydantic/networks.py
Expand Up @@ -363,12 +363,12 @@ def import_email_validator() -> None:
import email_validator
except ImportError as e:
raise ImportError('email-validator is not installed, run `pip install pydantic[email]`') from e
if hasattr(email_validator, "__version__") and email_validator.__version__.partition(".")[0] == "2":
if hasattr(email_validator, '__version__') and getattr(email_validator, '__version__', '').partition('.')[0] == '2':
return
else:
input_email = b"testaddr@example.tld"
valid_email = validate_email(input_email, check_deliverability=False)
if not hasattr(valid_email, "normalized"):
input_email = 'testaddr@example.tld'
valid_email = email_validator.validate_email(input_email, check_deliverability=False)
if not hasattr(valid_email, 'normalized'):
raise ImportError('email-validator version >= 2.0 required')


Expand Down

0 comments on commit 90f49f8

Please sign in to comment.