From: maopengzhang Date: Tue, 16 Jul 2019 08:40:29 +0000 (+0800) Subject: resolve python2->python3 issues X-Git-Tag: 1.3.4~15^2 X-Git-Url: https://gerrit.onap.org/r/gitweb?p=vfc%2Fgvnfm%2Fvnflcm.git;a=commitdiff_plain;h=b4aa6c19fdb3937fd91ca26da3d0e8c7f33c25f6 resolve python2->python3 issues change base64 code Change-Id: I063c4f256799c58e31e13e134d306359e8fd9d60 Issue-ID: VFC-1429 Signed-off-by: maopengzhang --- diff --git a/lcm/lcm/pub/utils/restcall.py b/lcm/lcm/pub/utils/restcall.py index 37ff668a..08c33c55 100644 --- a/lcm/lcm/pub/utils/restcall.py +++ b/lcm/lcm/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 @@ -39,7 +40,7 @@ def call_req(base_url, user, passwd, auth_type, resource, method, content='', ad 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 if additional_headers: headers.update(additional_headers)