# -*- coding: utf-8 -*- import sys, paramiko sys.stdout.reconfigure(encoding="utf-8", errors="replace") REMOTE = r""" cd /opt/douyinWEB/backend && .venv/bin/python3 <<'PY' from app import yt_assign_db, db groups = yt_assign_db.list_groups(include_urls=False, include_secret=True) for g in groups: pk = str(g.get('channel_pk') or '') ch = db.get_shorts_channel(pk) if pk else None print('GROUP', g.get('name'), 'enabled', g.get('enabled'), 'has_key', bool(g.get('stream_key'))) print(' group yt', g.get('youtube_channel_id')) print(' group pk', pk[:8] if pk else '') if ch: print(' shorts name', ch.get('name')) print(' shorts yt', ch.get('youtube_channel_id')) print(' shorts handle', ch.get('handle')) print() PY """ c=paramiko.SSHClient(); c.set_missing_host_key_policy(paramiko.AutoAddPolicy()) c.connect('108.174.50.68',22,'root','Xiao4669805',timeout=60,allow_agent=False,look_for_keys=False) _,o,_=c.exec_command(REMOTE,timeout=60) print(o.read().decode()); c.close()