AWS Lambda Requests Wrapper
Request/Response wrapper for AWS Lambda with API Gateway.
Install
Install and update using pip.
$ pip install -U aws-lambda-requests-wrapper
Example
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)
Contributing
Contributions are welcome via pull requests.
First time setup
$ 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
Running tests
$ poetry run pytest
Links
Metadata
Release files for aws-lambda-requests-wrapper 0.2.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| aws-lambda-requests-wrapper-0.2.3.tar.gz | 6.1 kB | Without provenance | Details for aws-lambda-requests-wrapper-0.2.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| aws_lambda_requests_wrapper-0.2.3-py3-none-any.whl | Python 3 | none | any | Details for aws_lambda_requests_wrapper-0.2.3-py3-none-any.whl |
Total release size: 12.8 kB
Release files / aws-lambda-requests-wrapper-0.2.3.tar.gz
| Download URL | aws-lambda-requests-wrapper-0.2.3.tar.gz |
|---|---|
| Size | 6.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
72e26ca658ab53dad1ff49fabfd947177b757e4c2d87bd5513a3cfd497fde288
|
|
BLAKE2b-256 checksum How to use checksums |
5de41b3fbb3e84b8932775034a3d65d7d1dd6344c2d093c7d90f11bc53165eac
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.12 CPython/3.10.2 Linux/5.11.0-1027-azure
|
Release files / aws_lambda_requests_wrapper-0.2.3-py3-none-any.whl
| Download URL | aws_lambda_requests_wrapper-0.2.3-py3-none-any.whl |
|---|---|
| Size | 6.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3aa401bed727129edbf9fcfbd5edb487f33784a4da9e4fb12664c27c93bb67f9
|
|
BLAKE2b-256 checksum How to use checksums |
881c9925ddeee1bfb731420e0cb6122deb0a1122f3af7df09aef0cec4794b5b3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.12 CPython/3.10.2 Linux/5.11.0-1027-azure
|
Security for aws-lambda-requests-wrapper 0.2.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.