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.
 
 

12 lines
441 B

import argparse
import requests
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument('host',default = "localhost:5138",nargs='?')
parser.add_argument('action',choices = ['on','off','toggle','kill'])
args = parser.parse_args()
r = requests.post('http://{host}?action={action}'.format(**args.__dict__))
if r.status_code == 204:
print('server killed')
else:
print(r.text)