Python class for use with Django to detect Disposable Emails
Project description
Python class for use with Django to detect Disposable Emails. Checks each email against a blacklist of ~890 domains used by various disposable email services.
Installation
It’s an ordinary Python package, just install via pip:
$ pip install django-disposable-email-checker
Download the example disposable email domains list or create your own and update settings.py:
$ cd /usr/share/ $ wget https://raw.github.com/aaronbassett/DisposableEmailChecker/master/disposable_email_domains.txt
Required Setting
Add the following setting to your Django settings.py:
DISPOSABLE_EMAIL_DOMAINS = "/usr/share/disposable_email_domains.txt"
Usage
To use the checker in your own scripts:
>>> from disposable_email_checker import DisposableEmailChecker >>> email_checker = DisposableEmailChecker() >>> email_checker.is_disposable("foo@guerrillamail.com") True
Using with Django
To use the checker during form validation, normally in forms.py:
from django import forms from django.utils.translation import ugettext_lazy as _ from disposable_email_checker import DisposableEmailChecker class MyForm(forms.Form): email = forms.EmailField(label=_('Email')) def clean_email(self): email_checker = DisposableEmailChecker() if email_checker.is_disposable(email): raise forms.ValidationError(_('Please use a different email address provider.')) return email
License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Close
Hashes for django-disposable-email-checker-0.2.2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 09814479715768e49d32ea528a8a022ea1b6d7f10f110d2a84277f68cefcc94a |
|
MD5 | d33898259b656b84fc8d5b21e193bc2b |
|
BLAKE2b-256 | 968e52876f75b7a7ff1e363b9949e4c5c8ca80afd1afbcd4f7f63d4f557a5e9f |