summaryrefslogtreecommitdiff
path: root/swiftclient
diff options
context:
space:
mode:
authorStephen Finucane <stephenfin@redhat.com>2022-02-17 11:21:40 +0000
committerTim Burke <tim.burke@gmail.com>2022-03-16 15:06:19 -0700
commit2636965f38a7788bbee19fc90088384834670b10 (patch)
treeba693b60748bdcea934e6a8434b158bc7fadeb91 /swiftclient
parent22a05b2039d0178b52fa3546de8ab265df112636 (diff)
downloadpython-swiftclient-2636965f38a7788bbee19fc90088384834670b10.tar.gz
Drop support for Python 2
There's a lot of cleanup possible, but this is a start. Signed-off-by: Stephen Finucane <stephenfin@redhat.com> Change-Id: Ia1176b7fd5434d52070d482a37abfbb98800cdb3
Diffstat (limited to 'swiftclient')
-rw-r--r--swiftclient/client.py18
1 files changed, 2 insertions, 16 deletions
diff --git a/swiftclient/client.py b/swiftclient/client.py
index 544247a..cc5478a 100644
--- a/swiftclient/client.py
+++ b/swiftclient/client.py
@@ -48,25 +48,11 @@ USER_METADATA_TYPE = tuple('x-%s-meta-' % type_ for type_ in
URI_PATTERN_INFO = re.compile(r'/info')
URI_PATTERN_VERSION = re.compile(r'\/v\d+\.?\d*(\/.*)?')
-try:
- from logging import NullHandler
-except ImportError:
- # Added in Python 2.7
- class NullHandler(logging.Handler):
- def handle(self, record):
- pass
-
- def emit(self, record):
- pass
-
- def createLock(self):
- self.lock = None
-
ksexceptions = ksclient_v2 = ksclient_v3 = ksa_v3 = None
try:
from keystoneclient import exceptions as ksexceptions
# prevent keystoneclient warning us that it has no log handlers
- logging.getLogger('keystoneclient').addHandler(NullHandler())
+ logging.getLogger('keystoneclient').addHandler(logging.NullHandler())
from keystoneclient.v2_0 import client as ksclient_v2
except ImportError:
pass
@@ -93,7 +79,7 @@ if StrictVersion(requests.__version__) < StrictVersion('2.0.0') \
requests.models.PreparedRequest.prepare_headers = prepare_unicode_headers
logger = logging.getLogger("swiftclient")
-logger.addHandler(NullHandler())
+logger.addHandler(logging.NullHandler())
#: Default behaviour is to redact header values known to contain secrets,
#: such as ``X-Auth-Key`` and ``X-Auth-Token``. Up to the first 16 chars