Last active
July 12, 2017 15:24
-
-
Save doobeh/861683c5810f1720328fffd403fdffac to your computer and use it in GitHub Desktop.
reboot project
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
import requests | |
@app.route('/form', methods=['GET', 'POST']) | |
def form(): | |
form = RebootForm() | |
ugly_messages = [] | |
if form.validate_on_submit(): | |
ip_addresses = form.available.data | |
for ip_address in ip_addresses: | |
requests.get('http://{}/rc.cgi?L=uirreboot.html&c=99'.format(ipaddress)) | |
ugly_messages.append('rebooting {}'.format(ipaddress)) | |
ugly_messages.append('Please wait 30s') | |
return "<br/>".join(ugly_messages) | |
return render_template('form.html', form=form) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment