Suggest corrections to user-misspelled email addresses
Project description
Suggest corrections to user-misspelled email addresses.
Python port of mailcheck.js.
Installation
$ pip install pymailcheck
Usage
>>> import pymailcheck
>>> pymailcheck.suggest("test@example.con")
{'domain': 'example.com', 'full': 'test@example.com', 'address': 'test'}
>>> pymailcheck.suggest("test@example.org")
False
You can override or append the built-in list of domains, top-level domains, and/or second-level domains:
Parameter |
Defaults |
Example |
---|---|---|
domains |
pymailcheck.DOMAINS |
yahoo.com |
top_level_domains |
pymailcheck.TOP_LEVEL_DOMAINS |
yahoo |
second_level_domains |
pymailcheck.SECOND_LEVEL_DOMAINS |
com |
>>> pymailcheck.suggest("test@contosl.com")
False
>>> custom_domains = ["example.com", "contoso.com"]
>>> pymailcheck.suggest("test@contosl.com", domains=custom_domains)
{'domain': 'contoso.com', 'full': 'test@contoso.com', 'address': 'test'}
>>> pymailcheck.suggest("test@contosl.com")
False
>>> custom_domains = pymailcheck.DOMAINS.union(("example.com", "contoso.com"))
>>> pymailcheck.suggest("test@contosl.com", domains=custom_domains)
{'domain': 'contoso.com', 'full': 'test@contoso.com', 'address': 'test'}
Running Tests
$ python -m unittest discover
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
pymailcheck-1.0.0.zip
(5.3 kB
view hashes)
Built Distributions
Close
Hashes for pymailcheck-1.0.0-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 29dbad220525507c72ea15d26af2c911d71a192ad34fe60f393a90256f37e1d2 |
|
MD5 | d6b90f0f7ed3cb1ebae3c11206654b3c |
|
BLAKE2b-256 | d2876b57fd85d24c55cc58cb8b9ca726e443fe1696d003434fa534593dc60be8 |
Close
Hashes for pymailcheck-1.0.0-py2-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9837b763d1e10a7988d91ddf47004297e7087d5ffccf2bae46bd9325e3318cdd |
|
MD5 | 4353eb11a676636f3e5f66740daa4127 |
|
BLAKE2b-256 | 9145e56d586d1c99307e858aecdad70399d54bc7115b34d8d31bf80665faf850 |