you did not say what error you get, but i can guess it relates to unicode vs bytes.
base64.encode takes a bytes object, you are giving it a string.
try replaceing decoded with decoded.encode('ascii') before passing into base64.b64encode
Welcome!
This is the community forum for my apps Pythonista and Editorial.
For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.