diff --git a/requests_kerberos/__init__.py b/requests_kerberos/__init__.py index 9bc6f05..fca7373 100644 --- a/requests_kerberos/__init__.py +++ b/requests_kerberos/__init__.py @@ -12,9 +12,14 @@ authentication. Basic GET usage: The entire `requests.api` should be supported. """ +import logging +import sys + from .kerberos_ import HTTPKerberosAuth, REQUIRED, OPTIONAL, DISABLED from .exceptions import MutualAuthenticationError +from .compat import NullHandler +logging.getLogger(__name__).addHandler(NullHandler()) __all__ = [HTTPKerberosAuth, MutualAuthenticationError, REQUIRED, OPTIONAL, DISABLED] __version__ = '0.1' diff --git a/requests_kerberos/compat.py b/requests_kerberos/compat.py new file mode 100644 index 0000000..01b7500 --- /dev/null +++ b/requests_kerberos/compat.py @@ -0,0 +1,14 @@ +""" +Compatibility library for older versions of python +""" +import sys + +# python 2.7 introduced a NullHandler which we want to use, but to support +# older versions, we implement our own if needed. +if sys.version_info[:2] > (2, 6): + from logging import NullHandler +else: + from logging import Handler + class NullHandler(Handler): + def emit(self, record): + pass