Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Click server
from flask import Flask, redirect, url_for
import os
app = Flask(__name__)
def index():
return """
<html><head><title>HDMI switcher</title><style>
.btn {
font-size: 20px;
padding: 10px 20px 10px 20px;
margin: 40px;
<form action="/click" method="POST">
<input type="submit" value="Switch Port" class="btn"/>
@app.route('/click', methods=['POST'])
def click():
os.system('sudo python')
return redirect(url_for('index'))
if __name__ == '__main__':'')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.