Decode jwt bytes object in Python 3 (#633)

This commit is contained in:
Colin Hoglund
2017-11-27 14:59:38 -08:00
committed by Jason White
parent 15cdc2f8fd
commit 84b43da76c
3 changed files with 10 additions and 3 deletions
+2
View File
@@ -23,6 +23,8 @@
################################################################################
*.pyc
.eggs/
.python-version
/GithubCredentials.py
/scripts/TwitterCredentials.py
+1 -1
View File
@@ -1,7 +1,7 @@
language: python
python:
- '2.7'
- '2.6'
- '2.7'
- '3.2'
- '3.3'
- '3.4'
+7 -2
View File
@@ -633,12 +633,17 @@ class GithubIntegration(object):
"exp": now + 60,
"iss": self.integration_id
}
return jwt.encode(
encrypted = jwt.encode(
payload,
key=self.private_key,
algorithm="RS256"
)
if atLeastPython3:
encrypted = encrypted.decode('utf-8')
return encrypted
def get_access_token(self, installation_id, user_id=None):
"""
Get an access token for the given installation id.
@@ -689,4 +694,4 @@ class GithubIntegration(object):
raise GithubException.GithubException(
status=response.status,
data=response_text
)
)