11import logging
2+ import os
23import azure .functions as func
34import 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
714def 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