Skip to main content

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.

Files for jinja2-shell-extension, version 0.0.3
Filename, size File type Python version Upload date Hashes
Filename, size jinja2_shell_extension-0.0.3-py3-none-any.whl (3.3 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size jinja2_shell_extension-0.0.3.tar.gz (2.8 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page