Product
Introducing License Enforcement in Socket
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
aws-lambda-requests-wrapper
Advanced tools
Request/Response wrapper for AWS Lambda with API Gateway.
Install and update using pip.
$ pip install -U aws-lambda-requests-wrapper
Converts the lambda_handler syntax:
import json
def lambda_handler(event, context):
...
response = {"key": "value"}
return {
"statusCode": 200,
"headers": {
"Content-Type": "application/json"
},
"body": json.dumps(response)
}
into this:
import json
from aws_lambda_requests_wrapper.lambda_handler import lambda_request_wrapper
from aws_lambda_requests_wrapper.models import Request
from aws_lambda_requests_wrapper.models import Response
@lambda_request_wrapper()
def lambda_handler(request: Request) -> Response:
...
response = {"key": "value"}
return Response(body=json.dumps(response))
or return a Pydantic model directly:
from pydantic import BaseModel
from aws_lambda_requests_wrapper.lambda_handler import lambda_request_wrapper
from aws_lambda_requests_wrapper.models import Request
class Model(BaseModel):
model_id: int
@lambda_request_wrapper()
def get_pydantic_model(request: Request) -> Model:
return Model(model_id=1)
Contributions are welcome via pull requests.
$ git clone git@github.com:DeveloperRSquared/aws-lambda-requests-wrapper.git
$ cd aws-lambda-requests-wrapper
$ poetry install
$ source .venv/bin/activate
Tools including black, mypy etc. will run automatically if you install pre-commit using the instructions below
$ pre-commit install
$ pre-commit run --all-files
$ poetry run pytest
FAQs
Request/Response wrapper for AWS Lambda with API Gateway
We found that aws-lambda-requests-wrapper demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
Product
We're launching a new set of license analysis and compliance features for analyzing, managing, and complying with licenses across a range of supported languages and ecosystems.
Product
We're excited to introduce Socket Optimize, a powerful CLI command to secure open source dependencies with tested, optimized package overrides.