From fecace66ed0730e76ac3015107b13eb8ca264bd8 Mon Sep 17 00:00:00 2001 From: phixxy Date: Wed, 27 Dec 2023 23:21:24 -0800 Subject: [PATCH] fixed uploading html/pngs in website func --- sparkytron3000.py | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/sparkytron3000.py b/sparkytron3000.py index 572281a..60305fb 100644 --- a/sparkytron3000.py +++ b/sparkytron3000.py @@ -1065,24 +1065,14 @@ async def website(ctx): await client.connect(ftp_server) await client.login(ftp_username, ftp_password) await client.change_directory(server_folder)''' - - - + for filename in os.listdir(local_folder): if ".png" in filename: - #await client.upload(local_folder + filename, filename, write_into=True) - async with asyncssh.connect(ftp_server, username=ftp_username, password=ftp_password) as conn: - async with conn.start_sftp_client() as sftp: - remotepath = server_folder + filename - await sftp.put(filename, remotepath=remotepath) + upload_sftp(filename, (os.getenv('ftp_public_html') + 'ai-webpage/'), filename) #explicitly upload html files last! for filename in os.listdir(local_folder): if ".html" in filename: - #await client.upload(local_folder + filename, filename, write_into=True) - async with asyncssh.connect(ftp_server, username=ftp_username, password=ftp_password) as conn: - async with conn.start_sftp_client() as sftp: - remotepath = server_folder + filename - await sftp.put(filename, remotepath=remotepath) + upload_sftp(filename, (os.getenv('ftp_public_html') + 'ai-webpage/'), filename) server_folder = ftp_public_html + 'ai-webpage/'