#!/usr/bin/env python3 import sys from pathlib import Path sys.path.insert(0, str(Path(__file__).resolve().parent)) import vps_ssh py = Path(__file__).with_name("_tmp_fetch_boot.py") py.write_text( "import urllib.request\n" "req=urllib.request.Request('http://127.0.0.1/provision/test-enjoy.boot.rsc', headers={'Host':'wifi.otantik.cm'})\n" "print(urllib.request.urlopen(req, timeout=20).read().decode())\n", encoding="utf-8", ) vps_ssh.put(str(py), "/tmp/wo-fetch-boot.py") code, out = vps_ssh.run("python3 /tmp/wo-fetch-boot.py") print(out) py.unlink(missing_ok=True)