Skip to content

Commit 22189e3

Browse files
author
Peter Yin
committed
Try to import from collections.abc, which will be required in Python 3.8+
1 parent cc710e0 commit 22189e3

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

jose/jws.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@
33
import json
44
import six
55

6-
from collections import Mapping, Iterable
6+
try:
7+
from collections.abc import Mapping, Iterable # Python 3
8+
except ImportError:
9+
from collections import Mapping, Iterable # Python 2, will be deprecated in Python 3.8
710

811
from jose import jwk
912
from jose.constants import ALGORITHMS

jose/jwt.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@
22
import json
33

44
from calendar import timegm
5-
from collections import Mapping
5+
try:
6+
from collections.abc import Mapping # Python3
7+
except ImportError:
8+
from collections import Mapping # Python2, will be depecrated in Python 3.8
69
from datetime import datetime
710
from datetime import timedelta
811
from six import string_types

0 commit comments

Comments
 (0)