Skip to content
This repository has been archived by the owner on Dec 1, 2018. It is now read-only.

Commit

Permalink
python 2/3 compat
Browse files Browse the repository at this point in the history
  • Loading branch information
dave-powell-kensho committed Mar 14, 2018
1 parent b45514d commit c6d1850
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
3 changes: 3 additions & 0 deletions pykube/oidc.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import base64
import json
import requests
import six
import time


Expand All @@ -27,6 +28,8 @@ def _id_token_expired(id_token):
if len(parts) != 3:
raise RuntimeError('ID Token is not valid')
payload_b64 = _pad_b64(parts[1])
if isinstance(payload_b64, six.binary_type):
payload_b64 = six.text_type(payload_b64, encoding='utf-8')
payload = base64.b64decode(payload_b64)
payload_json = json.loads(payload)
expiry = payload_json['exp']
Expand Down
5 changes: 0 additions & 5 deletions test/test_oidc.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import base64
import logging
import json
import unittest

from . import TestCase
from pykube import oidc
Expand Down Expand Up @@ -50,7 +49,3 @@ def test_id_token_expired(self):
payload_valid_b64 = self._payload_to_b64(payload_valid)
id_token_valid = id_token_fmt.format(payload_valid_b64)
self.assertFalse(oidc._id_token_expired(id_token_valid))


if __name__ == '__main__':
unittest.main()

0 comments on commit c6d1850

Please sign in to comment.