gridsmartercities / aws-lambda-decorators Goto Github PK
View Code? Open in Web Editor NEWA set of Python decorators to simplify AWS lambda development
License: MIT License
A set of Python decorators to simplify AWS lambda development
License: MIT License
With this bug it's possible to set a default value for an incorrect key when extracting a parameter. It's also possible for incorrect key names to persist across unit tests when the Parameter object persists across tests (default behaviour in python's unittest).
Testing using extract_from_event
with data:
event = {
"body": "{}"
}
and handler:
@extract_from_event(parameters=[Parameter(path="body[json]/optional/value", default="Hello")])
def handler(event, context, **kwargs):
return {
"statusCode": 200,
"body": json.dumps(kwargs)
}
The expected body would be {"value": "Hello"}
, however the actual response is currently {"optional": "Hello"}
When handling all exceptions it would be useful to be able to see the original error message, and not a friendly error message.
Making the friendly error message an optional parameter would help with this.
When I try to use the standard JWT header:
"Authorization":"bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9....",
it returns me
jwt.exceptions.DecodeError: Invalid header padding
However after I remove "bearer ", then it can decode it, no sweat.
Is there a way that I can support this schema without hacking it?
Thanks.
Add caching to the decoded parameters, so they are only extracted once.
We might want to extract name, email, ... from an event body which comes in as json. We want to extract the json body just once, instead of json load every single time we extract a parameter.
As introduced in #83 there is a caching mechanism. It would be awesome to make it configurable (disable, enabled by default), because this leads to a really strange behaviour for certain lambda functions.
After installing v0.48 in a virtual environment, this library's unit tests are included in the lib
folder in the virtual environment.
Hi,
Love the work you guys have done, this is awesome. I am trying to extract my "Authorization" from my headers (I see you currently do not support Bearer).
I am trying the following:
@extract_from_event(parameters=[
Parameter(
path="/headers[json]/Authorization", validators=[Mandatory], var_name="auth")
])
and receiving the following error:
{"message": "Error extracting parameters"}
any ideas?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.