aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormaopengzhang <zhang.maopeng1@zte.com.cn>2019-07-16 15:00:10 +0800
committermaopeng zhang <zhang.maopeng1@zte.com.cn>2019-07-16 07:02:14 +0000
commite21d3e267140135cc7124a7cfce336e55a2d44b9 (patch)
treea9883e0b87009fe16efac494086ced1bb741de86
parent1757a7e0f63f892200d680bb228db19ec993d1a2 (diff)
resolve python2->python3 issues
change base64 code Change-Id: I092efe7d586297a6389150b72c2f80fced1f7a2f Issue-ID: VFC-1429 Signed-off-by: maopengzhang <zhang.maopeng1@zte.com.cn>
-rw-r--r--lcm/pub/utils/restcall.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/lcm/pub/utils/restcall.py b/lcm/pub/utils/restcall.py
index 3cc6ed44..d59513ef 100644
--- a/lcm/pub/utils/restcall.py
+++ b/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
@@ -43,7 +44,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"))
ca_certs = None
if additional_headers:
headers.update(additional_headers)