Skip to content

Instantly share code, notes, and snippets.

@doobeh
Last active July 12, 2017 15:24
Show Gist options
  • Save doobeh/861683c5810f1720328fffd403fdffac to your computer and use it in GitHub Desktop.
Save doobeh/861683c5810f1720328fffd403fdffac to your computer and use it in GitHub Desktop.
reboot project
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