33import azure .functions as func
44import jwt
55
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__ )
12-
136
147def main (req : func .HttpRequest , outbound : func .Out [str ]) -> func .HttpResponse :
158 try :
16- logger .info ("Received HTTP request to upload CSV" )
9+ logging .info ("Received HTTP request to upload CSV" )
1710
1811 # Validate JWT token
1912 auth_header = req .headers .get ("Authorization" )
@@ -25,15 +18,15 @@ def main(req: func.HttpRequest, outbound: func.Out[str]) -> func.HttpResponse:
2518 if not validate_jwt (token , audience = os .environ .get ("FUNCTION_APP_CLIENT_ID" )):
2619 return func .HttpResponse ("Unauthorized" , status_code = 401 )
2720
28- logger .info ("Received HTTP request to upload CSV" )
21+ logging .info ("Received HTTP request to upload CSV" )
2922
3023 # Parse raw bytes derived from request body to string
3124 string_body = req .get_body ().decode ("utf-8" )
32- logger .info ("Parsed request body to string" )
25+ logging .info ("Parsed request body to string" )
3326
3427 # Upload parsed string body, which conforms to CSV format
3528 outbound .set (string_body )
36- logger .info ("Successfully uploaded CSV content" )
29+ logging .info ("Successfully uploaded CSV content" )
3730 return func .HttpResponse ("Successfully uploaded CSV content" , status_code = 200 )
3831
3932 except Exception as e :
0 commit comments