You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
logging.info(f'Python HTTP-triggered function processed: {obj.read()}')
364
362
```
365
363
366
-
When the function is invoked, the HTTP request is passed to the function as `req`. An entry will be retrieved from the Azure Blob Storage account based on the _ID_ in the route URL and made available as `obj` in the function body. Here, the specified storage account is the connection string that's found in the `AzureWebJobsStorage` app setting, which is the same storage account that's used by the function app.
364
+
When the function is invoked, the HTTP request is passed to the function as `req`. An entry will be retrieved from the Azure Blob Storage account based on the _ID_ in the route URL and made available as `obj` in the function body. Here, the specified storage account is the connection string that's found in the `CONNECTION_STRING` app setting.
367
365
::: zone-end
368
366
::: zone pivot="python-mode-decorators"
369
367
Inputs are divided into two categories in Azure Functions: trigger input and other input. Although they're defined using different decorators, their usage is similar in Python code. Connection strings or secrets for trigger and input sources map to values in the *local.settings.json* file when they're running locally, and they map to the application settings when they're running in Azure.
@@ -376,6 +374,7 @@ As an example, the following code demonstrates how to define a Blob Storage inpu
logging.info(f'Python HTTP-triggered function processed: {obj.read()}')
397
396
```
398
397
399
-
When the function is invoked, the HTTP request is passed to the function as `req`. An entry will be retrieved from the Azure Blob Storage account based on the _ID_ in the route URL and made available as `obj` in the function body. Here, the specified storage account is the connection string that's found in the AzureWebJobsStorage app setting, which is the same storage account that's used by the function app.
398
+
When the function is invoked, the HTTP request is passed to the function as `req`. An entry will be retrieved from the Azure Blob Storage account based on the _ID_ in the route URL and made available as `obj` in the function body. Here, the specified storage account is the connection string that's found in the `STORAGE_CONNECTION_STRING` app setting.
400
399
::: zone-end
401
400
402
401
For data intensive binding operations, you may want to use a separate storage account. For more information, see [Storage account guidance](storage-considerations.md#storage-account-guidance).
@@ -443,7 +442,7 @@ To produce multiple outputs, use the `set()` method provided by the [`azure.func
443
442
"direction": "out",
444
443
"type": "queue",
445
444
"queueName": "outqueue",
446
-
"connection": "AzureWebJobsStorage"
445
+
"connection": "STORAGE_CONNECTION_STRING"
447
446
},
448
447
{
449
448
"name": "$return",
@@ -457,7 +456,6 @@ To produce multiple outputs, use the `set()` method provided by the [`azure.func
457
456
```python
458
457
import azure.functions as func
459
458
460
-
461
459
defmain(req: func.HttpRequest,
462
460
msg: func.Out[func.QueueMessage]) -> str:
463
461
@@ -479,7 +477,7 @@ import azure.functions as func
Inside your *.venv* Python virtual environment folder, install your favorite Python test framework, such as `pip install pytest`. Then run `pytest tests` to check the test result.
@@ -1188,27 +1180,24 @@ You can start writing test cases for your HTTP trigger.
1188
1180
# <project_root>/tests/test_my_second_function.py
1189
1181
import unittest
1190
1182
import azure.functions as func
1191
-
from function_app import main
1192
1183
1184
+
from function_app import main
1193
1185
1194
1186
classTestFunction(unittest.TestCase):
1195
-
deftest_my_second_function(self):
1196
-
# Construct a mock HTTP request.
1197
-
req = func.HttpRequest(
1198
-
method='GET',
1199
-
body=None,
1200
-
url='/api/my_second_function',
1201
-
params={'value': '21'})
1202
-
1203
-
# Call the function.
1204
-
func_call = main.build().get_user_function()
1205
-
resp = func_call(req)
1206
-
1207
-
# Check the output.
1208
-
self.assertEqual(
1209
-
resp.get_body(),
1210
-
b'21 * 2 = 42',
1211
-
)
1187
+
deftest_my_second_function(self):
1188
+
# Construct a mock HTTP request.
1189
+
req = func.HttpRequest(method='GET',
1190
+
body=None,
1191
+
url='/api/my_second_function',
1192
+
params={'value': '21'})
1193
+
# Call the function.
1194
+
func_call = main.build().get_user_function()
1195
+
resp = func_call(req)
1196
+
# Check the output.
1197
+
self.assertEqual(
1198
+
resp.get_body(),
1199
+
b'21 * 2 = 42',
1200
+
)
1212
1201
```
1213
1202
1214
1203
Inside your *.venv* Python virtual environment folder, install your favorite Python test framework, such as `pip install pytest`. Then run `pytest tests` to check the test result.
@@ -1228,6 +1217,7 @@ The following example creates a named temporary file in the temporary directory
0 commit comments