From: maopengzhang Date: Tue, 16 Jul 2019 08:44:28 +0000 (+0800) Subject: resolve python2->python3 issues X-Git-Tag: 1.3.5~6 X-Git-Url: https://gerrit.onap.org/r/gitweb?a=commitdiff_plain;h=aec29027e6fceafe130b448083d6891d0f596ddf;p=vfc%2Fnfvo%2Fdriver%2Fvnfm%2Fgvnfm.git resolve python2->python3 issues change base64 code Change-Id: I251ff01f9ab471e7ab1341f2f80bac7c91aadfca Issue-ID: VFC-1429 Signed-off-by: maopengzhang --- diff --git a/gvnfmadapter/driver/pub/utils/restcall.py b/gvnfmadapter/driver/pub/utils/restcall.py index 28578cd..4b1aad6 100644 --- a/gvnfmadapter/driver/pub/utils/restcall.py +++ b/gvnfmadapter/driver/pub/utils/restcall.py @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +import base64 import sys import traceback import logging @@ -40,7 +41,7 @@ def call_req(base_url, user, passwd, auth_type, resource, method, content=''): full_url = combine_url(base_url, resource) headers = {'content-type': 'application/json', 'accept': 'application/json'} if user: - headers['Authorization'] = 'Basic ' + ('%s:%s' % (user, passwd)).encode("base64") + headers['Authorization'] = 'Basic %s' % base64.b64encode(bytes('%s:%s' % (user, passwd), "utf-8")).decode() ca_certs = None for retry_times in range(3): http = httplib2.Http(ca_certs=ca_certs, disable_ssl_certificate_validation=(auth_type == rest_no_auth))