forked from Testing1987/Insurance-API
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfunction_app.py
31 lines (24 loc) · 820 Bytes
/
function_app.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import azure.functions as func
import logging
app = func.FunctionApp()
# Learn more at aka.ms/pythonprogrammingmodel
# Get started by running the following code to create a function using a
@app.function_name(name="HttpTrigger1")
@app.route(route="hello")
def test_function(req: func.HttpRequest) -> func.HttpResponse:
logging.info('Python HTTP trigger function processed a request.')
name = req.params.get('name')
if not name:
try:
req_body = req.get_json()
except ValueError:
pass
else:
name = req_body.get('name')
if name:
return func.HttpResponse(f"Hello, {name}.function.")
else:
return func.HttpResponse(
"This HTTP triggered function executed successfully.",
status_code=200
)