commit e398678b0b5af568f40a568dbec4a1cd73557095 Author: vitrinekast Date: Tue Mar 12 14:49:21 2024 +0000 setup the first workflow diff --git a/renders/output.html b/renders/output.html new file mode 100644 index 0000000..75a270a --- /dev/null +++ b/renders/output.html @@ -0,0 +1,11 @@ + + + + + + Document + + +

I am a HTML page fillllllled with data, such as the b'up 1 week, 6 hours, 32 minutes\n'

+ + diff --git a/script.py b/script.py new file mode 100644 index 0000000..50aeaae --- /dev/null +++ b/script.py @@ -0,0 +1,26 @@ + +from jinja2 import Environment, FileSystemLoader + +## Getting the data +import subprocess + +#subprocess.run(["ls", "-l"]) +#print(os.popen("ls -l").read()) +thing = subprocess.run(["uptime", "-p"], capture_output=True) +print(thing.stdout) + +## Creating the HTML + +# loading the environment +env = Environment(loader = FileSystemLoader('templates')) + +# loading the template +template = env.get_template('template.jinja') + +# rendering the template and storing the resultant text in variable output +output = template.render(uptime = thing.stdout) + +# printing the output on screen +print(output) +with open("renders/output.html", 'w') as f: + print(output, file = f) diff --git a/templates/template.jinja b/templates/template.jinja new file mode 100644 index 0000000..0106eb4 --- /dev/null +++ b/templates/template.jinja @@ -0,0 +1,11 @@ + + + + + + Document + + +

I am a HTML page fillllllled with data, such as the {{ uptime }}

+ +