diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 9a204a9..b162857 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -1,3 +1,7 @@ +0.2.11: +- Make emitting logs off per default, observer the passed `debug` parameter +- Set updater log level to debug + 0.2.10: - Adding STARTTLS handling - Use EHLO instead of HELO diff --git a/README.rst b/README.rst index 6b85dc8..258b586 100644 --- a/README.rst +++ b/README.rst @@ -41,7 +41,7 @@ Basic usage:: :code:`use_blacklist`: use the blacklist of domains downloaded from https://github.com/martenson/disposable-email-domains -:code:`debug`: emit debug messages while checking email +:code:`debug`: emit debug/warning messages while checking email The function :code:`validate_email_or_fail()` works exactly like :code:`validate_email`, except that it raises an exception in the case of validation failure instead of returning :code:`False`. diff --git a/setup.py b/setup.py index b220e20..875897b 100644 --- a/setup.py +++ b/setup.py @@ -56,7 +56,7 @@ class BuildPyCommand(build_py): setup( name='py3-validate-email', - version='0.2.10', + version='0.2.11', packages=find_packages(exclude=['tests']), install_requires=['dnspython~=2.0', 'idna~=2.10', 'filelock~=3.0'], author='László Károlyi', diff --git a/validate_email/mx_check.py b/validate_email/mx_check.py index 1773950..fad5353 100644 --- a/validate_email/mx_check.py +++ b/validate_email/mx_check.py @@ -62,7 +62,6 @@ def _smtp_ehlo_tls(smtp: SMTP, helo_host: str): smtp.starttls() code, message = smtp.ehlo(name=helo_host) except SMTPNotSupportedError as exc: - print('XXX', exc) # The server does not support the STARTTLS extension pass except RuntimeError: diff --git a/validate_email/updater.py b/validate_email/updater.py index fe60932..5da0c5b 100644 --- a/validate_email/updater.py +++ b/validate_email/updater.py @@ -135,7 +135,7 @@ def update_builtin_blacklist( Update and reload the built-in blacklist. Return the `Thread` used to do the background update, so it can be `join()`-ed. """ - LOGGER.info(msg='Starting optional update of built-in blacklist.') + LOGGER.debug(msg='Starting optional update of built-in blacklist.') blacklist_updater = BlacklistUpdater() kwargs = dict(force=force, callback=callback) if not background: diff --git a/validate_email/validate_email.py b/validate_email/validate_email.py index bf28881..e25fae0 100644 --- a/validate_email/validate_email.py +++ b/validate_email/validate_email.py @@ -40,7 +40,8 @@ def validate_email_or_fail( dns_timeout=dns_timeout, debug=debug) -def validate_email(email_address: str, *args, **kwargs): +def validate_email( + email_address: str, *args, **kwargs): """ Return `True` or `False` depending if the email address exists or/and can be delivered. @@ -51,5 +52,6 @@ def validate_email(email_address: str, *args, **kwargs): return validate_email_or_fail(email_address, *args, **kwargs) except EmailValidationError as error: message = f'Validation for {email_address!r} failed: {error}' - LOGGER.warning(msg=message) + if kwargs.get('debug'): + LOGGER.warning(msg=message) return False