Files @ 5fb721461494
Branch filter:

Location: OneEye/exp/kerokero/ftp.py - annotation

Laman
minor fixes
import os
import json
import ftplib
import logging as log

thisDir=os.path.dirname(__file__)
with open(os.path.join(thisDir,"ftp.json")) as f:
	cfg=json.load(f)


def push(path):
	ftp=ftplib.FTP_TLS()
	ftp.connect(cfg["host"],cfg["port"])
	ftp.login(cfg["user"],cfg["password"])

	filename=os.path.basename(path)

	log.info("uploading %s",path)
	with open(path,mode="rb") as f:
		ftp.storbinary("STOR "+filename,f)

	ftp.close()


if __name__=="__main__":
	push(os.path.join(thisDir,"ftp.py"))