fix(python.d): urllib3 import collection for py3.10+ (#13136)
Ilya Mashchenko committed
Jun 15, 2022 at 00:00 UTC
0de08e8c1ecaa0b96fd2e305f6d504b40618ea1e
2 files changed
+13
-2
collectors/python.d.plugin/python_modules/urllib3/_collections.py
+6
-1
@@ -1,6 +1,11 @@
1
# SPDX-License-Identifier: MIT
2
from __future__ import absolute_import
3
-from collections import Mapping, MutableMapping
3
+
4
+try:
5
+ from collections import Mapping, MutableMapping
6
+except ImportError:
7
+ from collections.abc import Mapping, MutableMapping
8
+
9
try:
10
from threading import RLock
11
except ImportError: # Platform-specific: No threads available
collectors/python.d.plugin/python_modules/urllib3/util/selectors.py
+7
-1
@@ -12,7 +12,13 @@ import select
12
import socket
13
import sys
14
import time
15
-from collections import namedtuple, Mapping
15
+
16
+from collections import namedtuple
17
+
18
+try:
19
+ from collections import Mapping
20
+except ImportError:
21
+ from collections.abc import Mapping
22
23
try:
24
monotonic = time.monotonic