Created
February 8, 2021 19:25
-
-
Save fwarren/2afc9b1c688f7885b6320bcffd669b4a to your computer and use it in GitHub Desktop.
Simple Python Web Sever to return System information
This file contains 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 itty import get, post, run_itty | |
import os, subprocess | |
@get('/env/(?P<name>\w+)') | |
def lookup_environ_variable(request, name): | |
return os.environ[name] | |
@get('/freespace') | |
def compute_free_disk_space(request): | |
return subprocess.check_output('df') | |
@post('myrestart') | |
def test_post(request): | |
os.system('resteart') | |
run_itty(host='0.0.0.0', port=8095) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment