def upload_webdav(): options = { 'webdav_hostname': parse_config('WEBDAV', 'WEBDAV_UPLOAD_URL'), 'webdav_login': parse_config('WEBDAV', 'WEBDAV_UPLOAD_USER'), 'webdav_password': parse_config('WEBDAV', 'WEBDAV_UPLOAD_PW') } remotePath = parse_config('WEBDAV', 'WEBDAV_UPLOAD_PATH') client = Client(options) client.verify = False today = datetime.date.today() year, week_num, day_of_week = today.isocalendar() path = str(year) + "_cw" + str(week_num) if not client.check(remotePath + "/" + path): client.mkdir(remotePath + "/" + path) kwargs = { 'remote_path': remotePath + "/" + path + "/", 'local_path': targetPath + "/" + path + "/" } client.upload_async(**kwargs)
options = { 'webdav_hostname': token, 'webdav_login': login, 'webdav_password': password, } client = Client(options) rem_path = 'tmp' if not client.check(rem_path): # если нет, то создаём client.mkdir(rem_path) mymes('Directory [' + rem_path + '] created', 0) client.info(rem_path) video_path = './videos' files = os.listdir(video_path) free_space() for file in files: if re.fullmatch(r'Video\d\.\w{,5}', file): client.upload_async(remote_path=rem_path + '/' + file, local_path=video_path + '/' + file, callback=callback) upload_progress(file, '#', 0.3) callback_flag = False mymes('Uploading of all files is finished', 0) free_space() print("All work is done! Congratulations!!!!!!!!!")