a jinja2 extension to access to system environment variables
Project description
What is it ?
This is a jinja2 extension to execute system/shell commands from a template.
WARNING: be sure to valid any string submitted to this filter as you can open security holes with it
Syntax
The syntax is 'full_command_with_args'|shell([die_on_error_boolean_flag], [encoding])
.
Example
from jinja2 import Template, Environment
# We load the extension in a jinja2 Environment
env = Environment(extensions=["jinja2_shell_extension.ShellExtension"])
# For the example, we use a template from a simple string
template = env.from_string("{{ 'date --rfc-2822'|shell() }}")
result = template.render()
# example: result == "Fri, 31 Jan 2020 13:35:56 +0100"
# [...]
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for jinja2_shell_extension-0.0.3.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6574f7e9e1cb60d59b04da6172c8776b29960b32bca54e22489e0078eb91ef56 |
|
MD5 | 6ecc514674c272c2cc7f8470c8063644 |
|
BLAKE2b-256 | 965db7b45628ee313375366be9ae09a9e632e58062c785152c9a4661886b444d |
Close
Hashes for jinja2_shell_extension-0.0.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3dbc193db40eadee62a576eeda0ebf0940e6e4b9bf1207359004e4d9a69ba37b |
|
MD5 | e7a438d6d16b00b77966fa24a8053b58 |
|
BLAKE2b-256 | a23966a4a29ac063420c175559560eef33ea3eda0d7361d8ab985c2dadbb5e5e |