Make logging less intrusive
This commit is contained in:
parent
877b301ed6
commit
d3ec33f878
|
@ -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:
|
0.2.10:
|
||||||
- Adding STARTTLS handling
|
- Adding STARTTLS handling
|
||||||
- Use EHLO instead of HELO
|
- Use EHLO instead of HELO
|
||||||
|
|
|
@ -41,7 +41,7 @@ Basic usage::
|
||||||
|
|
||||||
:code:`use_blacklist`: use the blacklist of domains downloaded from https://github.com/martenson/disposable-email-domains
|
: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`.
|
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`.
|
||||||
|
|
||||||
|
|
2
setup.py
2
setup.py
|
@ -56,7 +56,7 @@ class BuildPyCommand(build_py):
|
||||||
|
|
||||||
setup(
|
setup(
|
||||||
name='py3-validate-email',
|
name='py3-validate-email',
|
||||||
version='0.2.10',
|
version='0.2.11',
|
||||||
packages=find_packages(exclude=['tests']),
|
packages=find_packages(exclude=['tests']),
|
||||||
install_requires=['dnspython~=2.0', 'idna~=2.10', 'filelock~=3.0'],
|
install_requires=['dnspython~=2.0', 'idna~=2.10', 'filelock~=3.0'],
|
||||||
author='László Károlyi',
|
author='László Károlyi',
|
||||||
|
|
|
@ -62,7 +62,6 @@ def _smtp_ehlo_tls(smtp: SMTP, helo_host: str):
|
||||||
smtp.starttls()
|
smtp.starttls()
|
||||||
code, message = smtp.ehlo(name=helo_host)
|
code, message = smtp.ehlo(name=helo_host)
|
||||||
except SMTPNotSupportedError as exc:
|
except SMTPNotSupportedError as exc:
|
||||||
print('XXX', exc)
|
|
||||||
# The server does not support the STARTTLS extension
|
# The server does not support the STARTTLS extension
|
||||||
pass
|
pass
|
||||||
except RuntimeError:
|
except RuntimeError:
|
||||||
|
|
|
@ -135,7 +135,7 @@ def update_builtin_blacklist(
|
||||||
Update and reload the built-in blacklist. Return the `Thread` used
|
Update and reload the built-in blacklist. Return the `Thread` used
|
||||||
to do the background update, so it can be `join()`-ed.
|
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()
|
blacklist_updater = BlacklistUpdater()
|
||||||
kwargs = dict(force=force, callback=callback)
|
kwargs = dict(force=force, callback=callback)
|
||||||
if not background:
|
if not background:
|
||||||
|
|
|
@ -40,7 +40,8 @@ def validate_email_or_fail(
|
||||||
dns_timeout=dns_timeout, debug=debug)
|
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
|
Return `True` or `False` depending if the email address exists
|
||||||
or/and can be delivered.
|
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)
|
return validate_email_or_fail(email_address, *args, **kwargs)
|
||||||
except EmailValidationError as error:
|
except EmailValidationError as error:
|
||||||
message = f'Validation for {email_address!r} failed: {error}'
|
message = f'Validation for {email_address!r} failed: {error}'
|
||||||
LOGGER.warning(msg=message)
|
if kwargs.get('debug'):
|
||||||
|
LOGGER.warning(msg=message)
|
||||||
return False
|
return False
|
||||||
|
|
Loading…
Reference in New Issue