Fix base64 error in python 3.9.
import sys
-import base64
import json
import subprocess
import traceback
import os.path
from functools import wraps
+try:
+ from base64 import encodebytes
+except ImportError:
+ from base64 import encodestring as encodebytes
+
try:
import ssl
except ImportError:
@@ -48,7 +52,7 @@ def get_basic_auth(host):
if username is None or secret is None:
return
basic_auth = ('%s:%s' % (username, secret)).encode('utf-8')
- basic_auth = base64.encodestring(basic_auth)
+ basic_auth = encodebytes(basic_auth)
return basic_auth.decode('ascii').replace('\n', '')
