rename
This commit is contained in:
@@ -3,7 +3,7 @@ import os
|
|||||||
from functools import partial
|
from functools import partial
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
from aws_lambda_powertools import Logger, Tracer
|
from aws_lambda_powertools import Logger
|
||||||
from aws_lambda_powertools.event_handler.api_gateway import (
|
from aws_lambda_powertools.event_handler.api_gateway import (
|
||||||
APIGatewayHttpResolver,
|
APIGatewayHttpResolver,
|
||||||
CORSConfig,
|
CORSConfig,
|
||||||
@@ -16,7 +16,6 @@ from api_gateway import JSONResponse
|
|||||||
from json_encoder import JSONEncoder
|
from json_encoder import JSONEncoder
|
||||||
from routes import courses, enrollments
|
from routes import courses, enrollments
|
||||||
|
|
||||||
tracer = Tracer()
|
|
||||||
logger = Logger(__name__)
|
logger = Logger(__name__)
|
||||||
cors = CORSConfig(
|
cors = CORSConfig(
|
||||||
allow_origin='*',
|
allow_origin='*',
|
||||||
@@ -46,6 +45,5 @@ def exc_error(exc: ServiceError):
|
|||||||
|
|
||||||
|
|
||||||
@logger.inject_lambda_context(correlation_id_path=correlation_paths.API_GATEWAY_HTTP)
|
@logger.inject_lambda_context(correlation_id_path=correlation_paths.API_GATEWAY_HTTP)
|
||||||
@tracer.capture_lambda_handler
|
|
||||||
def lambda_handler(event: dict[str, Any], context: LambdaContext) -> dict[str, Any]:
|
def lambda_handler(event: dict[str, Any], context: LambdaContext) -> dict[str, Any]:
|
||||||
return app.resolve(event, context)
|
return app.resolve(event, context)
|
||||||
|
|||||||
@@ -124,7 +124,7 @@ def sample(course_id: str, s3_uri: Annotated[str, Body(embed=True)]):
|
|||||||
content_type='application/pdf',
|
content_type='application/pdf',
|
||||||
status_code=HTTPStatus.OK,
|
status_code=HTTPStatus.OK,
|
||||||
headers={
|
headers={
|
||||||
'Content-Disposition': f'attachment; filename="{course_id}_sample.pdf"',
|
'Content-Disposition': f'attachment; filename="{course_id}.pdf"',
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user