"""Deploy small-account product whitelist.""" import paramiko, sys from pathlib import Path sys.stdout.reconfigure(encoding="utf-8", errors="replace") root = Path(__file__).resolve().parents[1] files = ["product_recommend.py", "symbols.py", "app.py", "install_trading.py", "templates/trade.html"] c = paramiko.SSHClient(); c.set_missing_host_key_policy(paramiko.AutoAddPolicy()) c.connect("192.168.8.21", username="root", password="woaini88", timeout=15) sftp = c.open_sftp() for rel in files: sftp.put(str(root / rel), f"/opt/qihuo/{rel.replace(chr(92), '/')}") print("uploaded", rel) sftp.close() _, o, _ = c.exec_command("cd /opt/qihuo && pm2 restart qihuo") print(o.read().decode("utf-8", errors="replace")) c.close()