Skip to content

Commit 8f4cf00

Browse files
committed
Use a caching resolver when checking email addresses in bulk on the command line
1 parent 4d4fa72 commit 8f4cf00

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

Diff for: email_validator/__init__.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -634,10 +634,12 @@ def __utf8_output_shim(output_str):
634634
return output_str
635635

636636
if len(sys.argv) == 1:
637+
# Validate the email addresses pased line-by-line on STDIN.
638+
dns_resolver = caching_resolver()
637639
for line in sys.stdin:
638640
email = __utf8_input_shim(line.strip())
639641
try:
640-
validate_email(email)
642+
validate_email(email, dns_resolver=dns_resolver)
641643
except EmailNotValidError as e:
642644
print(__utf8_output_shim("{} {}".format(email, e)))
643645
else:

0 commit comments

Comments
 (0)