-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathstart.py
29 lines (24 loc) · 845 Bytes
/
start.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import requests
import time
import json
QUEUEHOST = "192.168.93.174"
QUEUEPORT = 18888
STARTPATH = "/start"
def GetURLPath(HOST,PORT,PATH):
return "http://" + str(HOST) + ":" + str(PORT) + PATH
cls = input("是否启动Y/n:")
if cls == "Y" or cls == "y":
r = requests.post(GetURLPath(QUEUEHOST,QUEUEPORT,STARTPATH),data=json.dumps({"token":"243e21045c0c2912f5315907c8fc0775"}))
print(r.text)
while True:
time.sleep(2)
r = requests.post(GetURLPath(QUEUEHOST,QUEUEPORT,'/status'),data=json.dumps({"token":"243e21045c0c2912f5315907c8fc0775"}))
result = json.loads(r.text)
error = result["error"]
if error == '1':
now = result["now"]
All = result["All"]
print("进度{}/{}".format(now,All),end='\r')
if now >= All:
print("终于跑完啦!!")
break