Skip to content

Commit

Permalink
fix: make collections import compatible across Python versions (#419)
Browse files Browse the repository at this point in the history
* Use collections.abc, fixes #418

* Python 2.7 compat fix

* Fix check
  • Loading branch information
jay0lee authored and plamut committed Jan 17, 2020
1 parent f07fbe9 commit c5a3395
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions google/auth/jwt.py
Expand Up @@ -40,7 +40,10 @@
"""

import collections
try:
from collections.abc import Mapping
except ImportError: # Python 2.7 compatibility
from collections import Mapping
import copy
import datetime
import json
Expand Down Expand Up @@ -215,7 +218,7 @@ def decode(token, certs=None, verify=True, audience=None):

# If certs is specified as a dictionary of key IDs to certificates, then
# use the certificate identified by the key ID in the token header.
if isinstance(certs, collections.Mapping):
if isinstance(certs, Mapping):
key_id = header.get("kid")
if key_id:
if key_id not in certs:
Expand Down

0 comments on commit c5a3395

Please sign in to comment.