change base64 code
Change-Id: I092efe7d586297a6389150b72c2f80fced1f7a2f
Issue-ID: VFC-1429
Signed-off-by: maopengzhang <zhang.maopeng1@zte.com.cn>
# See the License for the specific language governing permissions and
# limitations under the License.
# See the License for the specific language governing permissions and
# limitations under the License.
import sys
import traceback
import logging
import sys
import traceback
import logging
full_url = combine_url(base_url, resource)
headers = {'content-type': 'application/json', 'accept': 'application/json'}
if user:
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)
ca_certs = None
if additional_headers:
headers.update(additional_headers)