Skip to content

Conversation

@geoffreybauduin
Copy link

Adding an optional check to prevent validating disposable emails


def is_disposable(email, debug=False):
"""Indicate whether the email is known as being a disposable email or not"""
for domain in _disposable:
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no no! do it better
do it like this:

email_domain = email.rsplit('@',1)[1]
if email_domain in _disposable:
    # logger stuff
    return True
return False

@geoffreybauduin
Copy link
Author

@wtayyeb thanks for your advices, I also took the liberty to change the list of disposable domains to a set, since the lookup is faster in a set than in a list.

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.

2 participants