我正在尝试部署一个函数应用程序,该应用程序从 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/