2 回答

TA貢獻(xiàn)1790條經(jīng)驗(yàn) 獲得超9個(gè)贊
我無(wú)法在本地存儲(chǔ)任何內(nèi)容,但我能夠?qū)⑽业膸椭绦蛭募?函數(shù)存儲(chǔ)在存儲(chǔ) blob 中,并使用以下命令在本地下載 blob:
with open(os.path.join(tempfile.gettempdir(), 'input.csv'), 'wb') as input: input.write(blob_client.download_blob().readall())
這并不能解決具體問題,但它是一個(gè)可以接受的解決方法。

TA貢獻(xiàn)1836條經(jīng)驗(yàn) 獲得超5個(gè)贊
我看到這個(gè)片段希望能完成類似的事情。我把與我無(wú)關(guān)的部分都拿出來(lái)了。這可以在 vscode 中使用函數(shù)應(yīng)用程序的測(cè)試功能時(shí)創(chuàng)建一個(gè)文件(func start):(來(lái)自https://option40.com/blog/azure)
import logging
import tempfile
import azure.functions as func
def main(req: func.HttpRequest) -> func.HttpResponse:
logging.info('Python HTTP trigger function processed a request.')
dir_path = tempfile.gettempdir()
file = dir_path + "\test.txt"
name = "Me"
with open(file, mode="w") as f:
f.write(f"{name}")
with open(file) as f:
new = f.read()
if name:
return func.HttpResponse(f"{file}, {new}")
else:
return func.HttpResponse(
"This HTTP triggered function executed successfully. Pass a name in the query string or in the request body for a personalized response.",
status_code=200
)
我的結(jié)果:C:\Users\myName\AppData\Local\Temp\test.txt,Me
添加回答
舉報(bào)