Comment 22 for bug 1799746

Revision history for this message
Corey Bryant (corey.bryant) wrote : Re: PY3: when uploading file as secret: TypeError: a bytes-like object is required, not 'str'

Makes sense! What that code does with plain text for py3 is base64.encode_as_bytes(plaintext) which results in bytes:

  >>> from oslo_serialization import base64
  >>> base64.encode_as_bytes('hello')
  b'aGVsbG8='

Basically what that does is:

  >>> base64.b64encode('hello'.encode('utf-8'))
  b'aGVsbG8='