python - 更改 Azure 存储 API 的 API 版本

标签 python azure azure-functions azure-storage

我正在尝试部署一个函数应用程序,该应用程序从 azure 存储帐户下载文件。在本地,当我运行代码时,它可以在 API 版本 2020-10-02 下正常工作。但是,从 Azure 函数运行代码时,它不起作用并引发以下错误:结果:失败异常:ValueError:不支持的 API 版本“2020-10-02”。请选择: 2019-02-02 2019-07-07 2019-10-10 2019-12-12 2020-02-10 2020-04-08 2020-06-12

我使用以下代码:

# Connect to CDE-Currated with the source list data
cdecurrated = DataLakeServiceClient.from_connection_string(
    conn_str)
logging.info('Connected to CDE-Currated')

# Get the csv file based on the request and convert to xml
sl_file = cdecurrated.get_file_client(
    file_system='source-list', 
    file_path=f'{request["file_path"]}/{request["file_name"]}'
)
df = pd.read_csv(BytesIO(sl_file.download_file().readall()))

最佳答案

Azure SDK for Python 中存在一个错误 - 我的同事通过 manually specifying the api-version 使其正常工作创建出现问题的 DataLakeServiceClient 时。

关于python - 更改 Azure 存储 API 的 API 版本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/71881560/

相关文章:

python - 在 Python 中,根据字典是否包含键为变量赋值的最小方法是什么?

python - NumPy 相当于合并

angular - 使用 ADAL Angular 6 Wrapper 调用 API

azure - 使用 Azure 功能的命令需要哪些 Azure 角色/权限

python - 在 PySide 中加载 QtDesigner 的 .ui 文件

python - 数字表达式错误 : "a = global_dict[name]"

Azure Function 在执行期间关闭

c# - 在 .Net 中使用 Spark 写入增量表

c# - 如何从计时器触发器获取 azure 函数运行位置的主机名?

azure - Microsoft.WindowsAzure.Storage (WindowsAzure.Storage) 9.1.1 在其依赖性之外调用 Newtonsoft 时失败