import json def lambda_handler(event, context): try: user = event.get("body").get("username") passwd = event.get("body").get("password") if user == "philippe@test.com" and passwd == "secret": return { "statusCode": 200, "headers": {"Content-Type": "application/json"}, "body": json.dumps({"pass" : passwd, "message": "Success"}) } else: return { "statusCode": 401, "headers": {"Content-Type": "application/json"}, "body": json.dumps({"message": "Invalid username or password"}) } except Exception as e: return { "statusCode": 400, "headers": {"Content-Type": "application/json"}, "body": json.dumps({"message": "Invalid request", "error": str(e)}) }