Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add possibility to cache dns lookups #58

Merged
merged 2 commits into from
Nov 15, 2020

Conversation

HeyHugo
Copy link
Contributor

@HeyHugo HeyHugo commented Nov 14, 2020

Add optional argument dns_resolver to validate_email. If provided it will be used instead of the default resolver. The provided resolver can have a configured cache and custom timeout. Closes #55

Example usage:

dns_resolver = dns.resolver.Resolver()
dns_resolver.cache = dns.resolver.Cache()
dns_resolver.timeout = 10
valid = validate_email("test@gmail.com", dns_resolver=dns_resolver)

@HeyHugo HeyHugo force-pushed the feature/cache-domains branch 5 times, most recently from 8638431 to 140f2ff Compare November 14, 2020 22:28
Add optional argument dns_resolver to validate_email. If provided it will be used instead of the default resolver. The provided resolver can have a configured cache and custom timeout.

Example usage:
dns_resolver = dns.resolver.Resolver()
dns_resolver.cache = dns.resolver.Cache()
dns_resolver.timeout = 10
valid = validate_email("test@gmail.com", dns_resolver=dns_resolver)
@HeyHugo HeyHugo force-pushed the feature/cache-domains branch from 140f2ff to c4f0e89 Compare November 15, 2020 17:23
@JoshData
Copy link
Owner

Excellent. This is basically what I was thinking. I made some tweaks. If you think it's OK, I'll merge. Happy to keep discussing otherwise.

@HeyHugo HeyHugo force-pushed the feature/cache-domains branch from c9e5547 to 7527a97 Compare November 15, 2020 20:06
@codecov-io
Copy link

codecov-io commented Nov 15, 2020

Codecov Report

Merging #58 (7527a97) into primary (fd76e66) will increase coverage by 0.34%.
The diff coverage is 100.00%.

Impacted file tree graph

@@             Coverage Diff             @@
##           primary      #58      +/-   ##
===========================================
+ Coverage    83.77%   84.12%   +0.34%     
===========================================
  Files            1        1              
  Lines          228      233       +5     
===========================================
+ Hits           191      196       +5     
  Misses          37       37              
Impacted Files Coverage Δ
email_validator/__init__.py 84.12% <100.00%> (+0.34%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update fd76e66...7527a97. Read the comment docs.

@HeyHugo
Copy link
Contributor Author

HeyHugo commented Nov 15, 2020

Nice!

Good with the helper function. Looks good.

I fixed linting so lint checks pass.

@JoshData JoshData merged commit 1431de0 into JoshData:primary Nov 15, 2020
@JoshData
Copy link
Owner

Thanks!

@WadeGulbrandsen
Copy link

The DNS resolve cache is great. Any ETA for when this will get pushed to pypi?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Idea: cache successful dns lookups?
4 participants