Fix py39 base64 has no attribute encodestring
Change-Id: Ida5ba5d2ef0b90b46a226451c8c10c910e5d4112
This commit is contained in:
parent
d6635aecd6
commit
c22568073a
|
@ -100,13 +100,9 @@ class GitHubAuth(object):
|
||||||
|
|
||||||
# This will prompt the user if either name or pass is missing.
|
# This will prompt the user if either name or pass is missing.
|
||||||
authstring = '%s:%s' % (self.username, self.password)
|
authstring = '%s:%s' % (self.username, self.password)
|
||||||
basic_auth = ''
|
|
||||||
try:
|
basic_auth = base64.encodebytes(bytes(authstring, 'utf-8'))
|
||||||
basic_auth = base64.encodestring(authstring)
|
basic_auth = basic_auth.decode('utf-8')
|
||||||
except TypeError:
|
|
||||||
# Python 3
|
|
||||||
basic_auth = base64.encodestring(bytes(authstring, 'utf-8'))
|
|
||||||
basic_auth = basic_auth.decode('utf-8')
|
|
||||||
basic_auth = basic_auth.strip()
|
basic_auth = basic_auth.strip()
|
||||||
header['Authorization'] = 'Basic %s' % basic_auth
|
header['Authorization'] = 'Basic %s' % basic_auth
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue