2 回答

TA貢獻1790條經驗 獲得超9個贊
我無法在本地存儲任何內容,但我能夠將我的幫助程序文件/函數存儲在存儲 blob 中,并使用以下命令在本地下載 blob:
with open(os.path.join(tempfile.gettempdir(), 'input.csv'), 'wb') as input: input.write(blob_client.download_blob().readall())
這并不能解決具體問題,但它是一個可以接受的解決方法。

TA貢獻1836條經驗 獲得超5個贊
我看到這個片段希望能完成類似的事情。我把與我無關的部分都拿出來了。這可以在 vscode 中使用函數應用程序的測試功能時創建一個文件(func start):(來自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
)
我的結果:C:\Users\myName\AppData\Local\Temp\test.txt,Me
添加回答
舉報