I have a csv file in azure blob storage that I would like to open and get certain data based on user input. I have two problems:
1) Empty AzureWebJobsStorage value in local.settings.json
I tried to input binding using AzureWebJobsStorage but the value seems empty. I'm not sure how I can what value I should edit in local.settings.json. Hence, getting this error:
Executed 'Functions.HttpExample' (Failed, Id=3a9309d6-7019-4de6-a8d2-43c89921b0f6) [18-Feb-20 9:40:36 AM] System.Private.CoreLib: Exception while executing function: Functions.HttpExample. Microsoft.Azure.WebJobs.Host: Value cannot be null. [18-Feb-20 9:40:36 AM] Parameter name: connectionString.
I updated the value with connection string of my storage account. It still did not work.
function.json :
{
"type": "blob",
"direction": "in",
"name": "container_name",
"path": "blob_name/file_name.csv",
"connection": "AzureWebJobsStorage"
}
Am I using the correct variable names above? As I also received another error :
The specified blob does not exist.
But the blob exist in the storage.
2) How do I display all data inside csv from this (assuming the above issue has resolved)
This is my current code in __init__.py
:
def main(req: func.HttpRequest, inputblob: func.InputStream) -> func.HttpResponse:
logging.info('Python HTTP trigger function processed a request.')
section = req.params.get('section')
bound = req.params.get('bound')
km_location = req.params.get('km_location')
location = req.params.get('location')
if not section:
try:
req_body = req.get_json()
except ValueError:
pass
else:
section = req_body.get('section')
if section and bound and km_location:
#pass the following user input to the following function and use them to retrieve remaining info
#from csv (stored in blob) to user.
result(section, km_location, bound, location).getResult()
return func.HttpResponse(f"Hello {section}, {bound}!")
container name/blob name
and why yourname
property iscontainer_name
and in your code is inputblob. – George Chenname
? What about AzureWebJobsStorage value? What value does it takes? – cna