summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFu Jinhua <fu.jinhua@zte.com.cn>2019-07-16 09:27:44 +0000
committerGerrit Code Review <gerrit@onap.org>2019-07-16 09:27:44 +0000
commit2a3979ebe783f2e9377f8018bbc3586e87b6ec51 (patch)
tree192b679742b2706bc8bd7883289d1f3de5b694cf
parentc806beecdb2b6e1baa8d5ce07c031ca8bc605dca (diff)
parentb4aa6c19fdb3937fd91ca26da3d0e8c7f33c25f6 (diff)
Merge "resolve python2->python3 issues"
-rw-r--r--lcm/lcm/pub/utils/restcall.py3
1 files changed, 2 insertions, 1 deletions
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)