Skip to content

Commit b7982cb

Browse files
committed
Change bindings model to v1
1 parent cacccb8 commit b7982cb

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

hvalfangst_function/upload_csv/__init__.py

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,19 @@
11
import logging
2+
import os
23
import azure.functions as func
34
import jwt
4-
import os
5+
6+
# Decree and declare our project as an Azure Function App subsidiary
7+
app = func.FunctionApp()
8+
9+
# Configure logging
10+
logging.basicConfig(level=logging.DEBUG)
11+
logger = logging.getLogger(__name__)
512

613

714
def main(req: func.HttpRequest, outbound: func.Out[str]) -> func.HttpResponse:
815
try:
9-
logging.info("Received HTTP request to upload CSV")
16+
logger.info("Received HTTP request to upload CSV")
1017

1118
# Validate JWT token
1219
auth_header = req.headers.get("Authorization")
@@ -18,15 +25,15 @@ def main(req: func.HttpRequest, outbound: func.Out[str]) -> func.HttpResponse:
1825
if not validate_jwt(token, audience=os.environ.get("FUNCTION_APP_CLIENT_ID")):
1926
return func.HttpResponse("Unauthorized", status_code=401)
2027

21-
logging.info("Received HTTP request to upload CSV")
28+
logger.info("Received HTTP request to upload CSV")
2229

2330
# Parse raw bytes derived from request body to string
2431
string_body = req.get_body().decode("utf-8")
25-
logging.info("Parsed request body to string")
32+
logger.info("Parsed request body to string")
2633

2734
# Upload parsed string body, which conforms to CSV format
2835
outbound.set(string_body)
29-
logging.info("Successfully uploaded CSV content")
36+
logger.info("Successfully uploaded CSV content")
3037
return func.HttpResponse("Successfully uploaded CSV content", status_code=200)
3138

3239
except Exception as e:

0 commit comments

Comments
 (0)