I'm new to using python and flask and really like it. I'm returning a query to be displayed in a jinja template and one of my columns being returned has base64 data. How do I decode that data and display it.
In jinja To work with Base64 encoded strings:
{{ encoded | b64decode }}
{{ decoded | b64encode }}
For more http://docs.ansible.com/ansible/playbooks_filters.html
You can try to write custom filter
# add filter to jinja2 env
environment.filters['b64decode'] = base64.b64decode
# in template use
{{ value|b64decode }}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With