purus
purus parses parameters provided from Lambda@Edge on CloudFront, and it manipulates request and response.
It is named after The Purus River, or a tributary of The Amazon River.
Install
$ pip install purus
Usage
CloudFront:Lambda@Edge
purus can parse parameters of
- viewer-request
- origin-request
- origin-response
- viewer-response
# Lambda@Edge
from purus.amazon_cloudfront import CloudFrontLambdaEdge
# on viewer-request or origin-request
def lambda_handler(event: dict, _):
# load data
lambda_edge = CloudFrontLambdaEdge.from_event(event=event)
# return on error
if some_error_occurred:
pseudo_payload = lambda_edge.add_pseudo_response(
status="400",
status_description="error_occurred"
)
return pseudo_payload.response.format()
# redirect
if redirect_condition:
pseudo_payload = lambda_edge.add_pseudo_redirect_response(
status="307",
status_description="Redirect",
location_url="https://redirect.example.com"
)
return pseudo_payload.response.format()
# add headers to request
modified_request = lambda_edge.append_request_header(
key="X-Original-Header",
value="Your data"
).append_request_header(
key="X-Original-Header",
value="Your additional data"
)
# to request
return modified_request.request.format()
Metadata
Release files for purus 0.1.1
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 |
|---|---|---|---|---|
| purus-0.1.1.tar.gz | 7.0 kB | Without provenance | Details for purus-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| purus-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for purus-0.1.1-py3-none-any.whl |
Total release size: 13.8 kB
Release files / purus-0.1.1.tar.gz
| Download URL | purus-0.1.1.tar.gz |
|---|---|
| Size | 7.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2f15124f1b104b5d93a1e0ef0ac4fdf64481eec5c05a8828ff794b35f85e535b
|
|
BLAKE2b-256 checksum How to use checksums |
6fec8650aa9566afe6a9bd189ce61df4be06b7ba29edd52e6955e97c6a9bf18e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.2.0 CPython/3.8.13 Linux/5.15.0-1019-azure
|
Release files / purus-0.1.1-py3-none-any.whl
| Download URL | purus-0.1.1-py3-none-any.whl |
|---|---|
| Size | 6.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f57295ddfe4fd7c44694c61f7e590f21665bc01a5610bf43841b78f8c1935279
|
|
BLAKE2b-256 checksum How to use checksums |
298ddbfd75bd414d47b645a407fb1b56be187f8b0eb8db3cd971055028e6794f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.2.0 CPython/3.8.13 Linux/5.15.0-1019-azure
|
Security for purus 0.1.1
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.