from ftplib import FTP_TLS as FTP from getpass import getpass import json import io import datetime fileName = "modpack.mrpack" username = input("Username: ") password = getpass() version_tag = input("Version Number: ") ftp = FTP("gitea.piwalker.net", username, password) ftp.prot_p() bio = io.BytesIO() ftp.retrbinary("RETR versions.json", bio.write) bio.seek(0) versions = json.load(bio) bio.close() time = datetime.datetime.now().strftime("%Y-%m-%d-%H-%M-%S") versions.append({"Version":version_tag, "Date":time, "File":"Versions/fcs7-"+time+".mrpack"}) with open(fileName, 'rb') as fp: ftp.storbinary("STOR "+versions[len(versions)-1]["File"], fp) bio = io.BytesIO() bio.write(json.dumps(versions).encode()) bio.seek(0) ftp.storbinary("STOR versions.json", bio) bio.close() ftp.close()