39 lines
1.2 KiB
Python
39 lines
1.2 KiB
Python
import urllib.request, json
|
|||
|
|
|
||
|
|
# 1. write-go root
|
||
|
|
try:
|
||
|
|
r = urllib.request.urlopen('http://localhost:8016/', timeout=5)
|
||
|
|
print('8016 / :', r.status)
|
||
|
|
except Exception as e:
|
||
|
|
print('8016 / : ERROR -', e)
|
||
|
|
|
||
|
|
# 2. write-go admin page (fe)
|
||
|
|
try:
|
||
|
|
r = urllib.request.urlopen('http://localhost:8016/admin', timeout=5)
|
||
|
|
print('8016 /admin:', r.status)
|
||
|
|
except Exception as e:
|
||
|
|
print('8016 /admin: ERROR -', e)
|
||
|
|
|
||
|
|
# 3. bot-go status
|
||
|
|
try:
|
||
|
|
r = urllib.request.urlopen('http://127.0.0.1:8017/status', timeout=5)
|
||
|
|
d = json.loads(r.read().decode())
|
||
|
|
print('8017 /status:', d)
|
||
|
|
except Exception as e:
|
||
|
|
print('8017 /status: ERROR -', e)
|
||
|
|
|
||
|
|
# 4. bot-go start
|
||
|
|
try:
|
||
|
|
req = urllib.request.Request('http://127.0.0.1:8017/start', method='POST')
|
||
|
|
r = urllib.request.urlopen(req, timeout=5)
|
||
|
|
print('8017 /start:', r.status, r.read().decode()[:200])
|
||
|
|
except Exception as e:
|
||
|
|
print('8017 /start: ERROR -', e)
|
||
|
|
|
||
|
|
# 5. bot-go stop
|
||
|
|
try:
|
||
|
|
req = urllib.request.Request('http://127.0.0.1:8017/stop', method='POST')
|
||
|
|
r = urllib.request.urlopen(req, timeout=5)
|
||
|
|
print('8017 /stop:', r.status, r.read().decode()[:200])
|
||
|
|
except Exception as e:
|
||
|
|
print('8017 /stop: ERROR -', e)
|