|
| 1 | +# pyIsEmail |
| 2 | + |
| 3 | +[][crate] |
| 4 | +[][travis] |
| 5 | +[][coveralls] |
| 6 | + |
| 7 | +[crate]: https://crate.io/package/pyIsEmail |
| 8 | +[travis]: http://travis-ci.org/michaelherold/pyIsEmail |
| 9 | +[coveralls]: https://coveralls.io/r/michaelherold/pyIsEmail |
| 10 | + |
| 11 | +## Getting Started |
| 12 | + |
| 13 | +pyIsEmail is a no-nonsense approach for checking whether that user-supplied |
| 14 | +email address could be real. Sick of not being able to use |
| 15 | +[email address tagging][tagging] to sort through your [Bacn][bacn]? We can fix |
| 16 | +that. |
| 17 | + |
| 18 | +Regular expressions are cheap to write, but often require maintenance when new |
| 19 | +top-level domains come out or don't conform to email addressing features that |
| 20 | +come back into vogue. pyIsEmail allows you to validate an email address -- and |
| 21 | +even check the domain, if you wish -- with one simple call, making your code |
| 22 | +more readable and faster to write. When you want to know why an email address |
| 23 | +doesn't validate, we even provide you with a diagnosis. |
| 24 | + |
| 25 | +[tagging]: http://en.wikipedia.org/wiki/Email_address#Address_tags |
| 26 | +[bacn]: http://en.wikipedia.org/wiki/Bacn |
| 27 | + |
| 28 | +## Install |
| 29 | + |
| 30 | +Install from PyPI using [pip], a package manager for Python. |
| 31 | + |
| 32 | + $ pip install pyIsEmail |
| 33 | + |
| 34 | +Don't have pip installed? Try installing it, by running this from the command |
| 35 | +line: |
| 36 | + |
| 37 | + $ curl https://raw.github.com/pypa/pip/master/contrib/get-pip.py | python |
| 38 | + |
| 39 | +Or, you can [download the source code (zip)][zipball] for ``pyIsEmail``, and |
| 40 | +then run: |
| 41 | + |
| 42 | + $ python setup.py install |
| 43 | + |
| 44 | +You may need to run the above commands with ``sudo``. |
| 45 | + |
| 46 | +[pip]: http://www.pip-installer.org/en/latest/ |
| 47 | +[zipball]: https://github.com/michaelherold/pyIsEmail/zipball/develop |
| 48 | + |
| 49 | +## Usage |
| 50 | + |
| 51 | +For the simplest usage, import and use the ``is_email`` function: |
| 52 | + |
| 53 | +```python |
| 54 | + |
| 55 | +from pyisemail import is_email |
| 56 | + |
| 57 | +address = "test@example.com" |
| 58 | +bool_result = is_email(address) |
| 59 | +detailed_result = is_email(address, diagnose=True) |
| 60 | +``` |
| 61 | + |
| 62 | +You can also check whether the domain used in the email is a valid domain and |
| 63 | +whether or not it has a valid MX record: |
| 64 | + |
| 65 | +```python |
| 66 | + |
| 67 | +from pyisemail import is_email |
| 68 | + |
| 69 | +address = "test@example.com" |
| 70 | +bool_result_with_dns = is_email(address, check_dns=True) |
| 71 | +detailed_result_with_dns = is_email(address, check_dns=True, diagnose=True) |
| 72 | +``` |
| 73 | + |
| 74 | +These are primary indicators of whether an email address can even be issued at |
| 75 | +that domain. However, a valid response here *is not a guarantee that the email |
| 76 | +exists*, merely that is *can* exist. |
| 77 | + |
| 78 | +In addition to the base ``is_email`` functionality, you can also use the |
| 79 | +validators by themselves. Check the validator source code to see how this works. |
| 80 | + |
| 81 | +## Uninstall |
| 82 | + |
| 83 | +Want to get rid of pyIsEmail? Did you install with pip? Here you go: |
| 84 | + |
| 85 | + $ pip uninstall pyIsEmail |
| 86 | + |
| 87 | +## Acknowledgments |
| 88 | + |
| 89 | +The base ``ParserValidator`` is based off of [Dominic Sayers][dominic]' |
| 90 | +[is_email script][is_email]. I wanted the functionality in Python, so I ported |
| 91 | +it from the original PHP. |
| 92 | + |
| 93 | +[dominic]: https://github.com/dominicsayers |
| 94 | +[is_email]: https://github.com/dominicsayers/isemail |
| 95 | + |
| 96 | +## Contributing |
| 97 | + |
| 98 | +1. Fork it |
| 99 | +2. Create your feature branch (``git checkout -b my-new-feature``) |
| 100 | +3. Commit your changes (``git commit -am 'Add some feature'``) |
| 101 | +4. Push to the branch (``git push origin my-new-feature``) |
| 102 | +5. Create new Pull Request |
| 103 | + |
| 104 | +## Versioning |
| 105 | + |
| 106 | +This library aims to adhere to [Semantic Versioning 2.0.0][semver]. Violations |
| 107 | +of this scheme should be reported as bugs. |
| 108 | + |
| 109 | +[semver]: http://semver.org/ |
| 110 | + |
| 111 | +## Copyright |
| 112 | + |
| 113 | +Copyright (c) 2013 Michael Herold. Open sourced under the terms of the |
| 114 | +[MIT license][license]. |
| 115 | + |
| 116 | +[license]: http://opensource.org/licenses/MIT |
0 commit comments