You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

11 lines
441 B

7 years ago
  1. import argparse
  2. import requests
  3. if __name__ == "__main__":
  4. parser = argparse.ArgumentParser()
  5. parser.add_argument('host',default = "localhost:5138",nargs='?')
  6. parser.add_argument('action',choices = ['on','off','toggle','kill'])
  7. args = parser.parse_args()
  8. r = requests.post('http://{host}?action={action}'.format(**args.__dict__))
  9. if r.status_code == 204:
  10. print('server killed')
  11. else:
  12. print(r.text)