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.

Source Distribution

jinja2_shell_extension-0.0.6.tar.gz (3.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

jinja2_shell_extension-0.0.6-py3-none-any.whl (3.3 kB view details)

Uploaded Python 3

File details

Details for the file jinja2_shell_extension-0.0.6.tar.gz.

File metadata

  • Download URL: jinja2_shell_extension-0.0.6.tar.gz
  • Upload date:
  • Size: 3.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.7

File hashes

Hashes for jinja2_shell_extension-0.0.6.tar.gz
Algorithm Hash digest
SHA256 12808f1bcfb2f399558bb1187254e9322d3a5a183e8589f48c6217f7fbcc4e45
MD5 a42a61244fb8d6f95499076002e960ef
BLAKE2b-256 2a8a70485a19366bf66f90ce732d43674407b7b4c4065c71437ed4858ab32f89

See more details on using hashes here.

File details

Details for the file jinja2_shell_extension-0.0.6-py3-none-any.whl.

File metadata

File hashes

Hashes for jinja2_shell_extension-0.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 55348e2b141f3997d20a7208dfe4e1d72b886c25cf8ea6e7f20e8f307393d86c
MD5 7ea42135f744b93b9dde7317aa201bc7
BLAKE2b-256 4db61ac1468135f79e822adcef931c1849c11c38d2115489e0331043dbd20e42

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page