Files
blog/tmp_final2.py
T
2026-06-01 17:57:22 +08:00

25 lines
914 B
Python

import urllib.request, json
print("=== WriteServer (8016) ===")
r = urllib.request.urlopen('http://localhost:8016/', timeout=5)
print(" / :", r.status, "- HTML page OK")
r = urllib.request.urlopen('http://localhost:8016/api/stats', timeout=5)
print(" stats :", r.read().decode())
r = urllib.request.urlopen('http://localhost:8016/api/posts?perPage=1', timeout=5)
print(" posts :", r.status, "- OK")
print("")
print("=== WriteBot (8017) ===")
r = urllib.request.urlopen('http://127.0.0.1:8017/health', timeout=5)
print(" health :", r.read().decode())
r = urllib.request.urlopen('http://127.0.0.1:8017/status', timeout=5)
d = json.loads(r.read().decode())
print(" status : running=" + str(d.get('running')) + " ip=" + str(d.get('ip')))
print("")
print("Admin Panel: http://127.0.0.1:8017/")
print("WriteServer: http://localhost:8016/")
print("LAN Access : http://" + str(d.get('ip')) + ":8016/")