import paramiko, json from pathlib import Path c = paramiko.SSHClient() c.set_missing_host_key_policy(paramiko.AutoAddPolicy()) c.connect("82.157.112.245", username="ubuntu", password="Xiao4669805", timeout=20) cmd = r""" python3 - <<'PY' import json, urllib.request print('health', urllib.request.urlopen('https://api.nomadro.cn/health').read().decode()) req = urllib.request.Request( 'https://api.nomadro.cn/api/admin/login', data=json.dumps({'username':'admin','password':'Xiao4669805'}).encode(), headers={'Content-Type':'application/json'} ) tok = json.loads(urllib.request.urlopen(req).read().decode())['token'] req2 = urllib.request.Request( 'https://api.nomadro.cn/api/admin/stats', headers={'Authorization': f'Bearer {tok}'} ) print('stats', urllib.request.urlopen(req2).read().decode()) req3 = urllib.request.Request( 'https://api.nomadro.cn/api/admin/checklist', headers={'Authorization': f'Bearer {tok}'} ) print('checklist_items', len(json.loads(urllib.request.urlopen(req3).read().decode())['items'])) print('admin_html_ok', 'Nomadro Admin' in urllib.request.urlopen('https://admin.nomadro.cn/').read().decode()) PY """ _, o, e = c.exec_command(cmd) Path("deploy/final-verify.txt").write_text( o.read().decode("utf-8", "replace") + "\nERR\n" + e.read().decode("utf-8", "replace"), encoding="utf-8", ) c.close() print("ok")