Created
December 13, 2015 18:12
-
-
Save bkeating/acc0fddbb8f661d42586 to your computer and use it in GitHub Desktop.
SysAPI - A Simple Example using bottle.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from bottle import route, run, template, redirect | |
import socket | |
import subprocess | |
@route('/hello/<name>') | |
def index(name): | |
print(subprocess.call(["du", "-sh"])) | |
return template('<b>Hello {{name}}</b>!', name=name) | |
@route('/overview') | |
def index(): | |
hostname = socket.gethostname() | |
du = subprocess.check_output(['df', '-h']) | |
subprocess.call(["say", "Vagina"]) | |
return template('overview', hostname=hostname, du=du) | |
run(port=8000, host='10.0.1.106') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<title>System Overview</title> | |
</head> | |
<body> | |
<h1>System Overview</h1> | |
Host: <strong>{{ hostname }}</strong> | |
<strong> | |
<h2>Disk Usage</h2> | |
<pre>{{ du }}</pre> | |
</strong> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment