Skip to main content


is there a way to take a json result from an HTTP GET and convert to base64 within siemplify? I'm overlooking if such an action exists. Thanks


or really any form of Encode Base64 function. I might be overlooking it or don't have the right integration/powerup installed. :)



well there didn't seem to be one available, so i wrote one based on the Decode Base64 action. here it is if you ever want it for yourself.



# desc: encode b64 action, written by Jim T


# ver : v1.0


# date: 7/27/2022





from SiemplifyAction import SiemplifyAction


from SiemplifyUtils import output_handler





import json


import base64





def main():


siemplify = SiemplifyAction()


text_input = siemplify.parameters.get("Text Input")


encoding = siemplify.parameters.get("Encoding")





text_bytes = text_input.encode(encoding)


encoded_content = str(base64.b64encode(text_bytes), 'UTF-8')


result = {'encoded_content': (encoded_content)}





siemplify.result.add_result_json(json.dumps(result))


siemplify.end('Content was succesfully encoded to base 64.', True)





if __name__ == "__main__":


main()



This comment was originally sent by Tom Fridman


Wonderful
@James_Tippen


Reply