edit : 원격 저장으로 변경

This commit is contained in:
2025-04-28 14:23:46 +09:00
parent 6b212125a4
commit 4c2ea70289
8 changed files with 64 additions and 19 deletions

29
utils/custom_sftp.py Normal file
View File

@@ -0,0 +1,29 @@
import paramiko
class CustomSFTPClient():
def __init__(self):
host = "192.168.200.230"
port = 22
id = "fermat"
pw = "1234"
self.ssh_client = paramiko.SSHClient()
self.ssh_client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
self.ssh_client.connect(hostname=host, port=port, username=id, password=pw)
self.sftp_client = self.ssh_client.open_sftp()
def remote_mkdir(self, remote_path):
self.sftp_client.mkdir(remote_path)
def remote_copy_data(self,local_path, remote_path):
self.sftp_client.put(local_path, remote_path)
def client_close(self):
self.sftp_client.close()
self.ssh_client.close()
sftp_client = None
if sftp_client is None:
sftp_client = CustomSFTPClient()