【发布时间】:2018-06-21 12:32:53
【问题描述】:
我写了一个通用函数来将文件上传到天蓝色存储,但无法弄清楚两件事..
- 如何查看上传是否成功
- 如何查看进度(天蓝色函数采用布尔参数进度回调,但我不知道如何使用它)
这是我写的函数:
def upload_files_to_azure(share, directory, path_of_file):
"""
Function to upload file to the azure storage, in a particular share into a particular directory
:param share: name of share of azure storage
:param directory: directory name inside azure storage
:param path_of_file: the path of file to be uploaded
:return: status of file uploaded
"""
file_service = FileService(account_name=ACCOUNT_NAME, account_key=ACCOUNT_KEY)
file_service.create_file_from_path(
share,
directory, # We want to create this blob in the root directory, so we specify None for the directory_name
'test.sql20180103.tar.gz',
path_of_file,
content_settings=ContentSettings(content_type='application/x-gzip'))
return
【问题讨论】:
-
关于#2,你能详细描述一下吗?请分享您遇到的任何文档链接。
标签: python python-3.x azure azure-storage