You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Originally posted by nilsm0hr February 1, 2023
Hi,
I tired to understand the compress option in PowerTools. We have started to implement powertools on our functions. Some of them compressed the Lambda response in our python code and returned the base64 payload to enable larger payloads.
The documentation suggests that you just return an object, rather than the Response object powertools provides. Looking at the source code, I managed to use the powertools response object after I dumped my json response to a string.
Would it be possible to make the docs a bit clearer around this? Not quite sure if I am misunderstanding something here.
hey @nilsm0hr, I've read between the lines that you didn't pass a str or bytes to the Response(body=...). Then after investigating the code, or type hints in your IDE within Response, you've noticed we take string or bytes, then use Gzip to compress it hence changing to a string.
Activity
heitorlessa commentedon Jun 8, 2023
creating a PR for this now...
hey @nilsm0hr, I've read between the lines that you didn't pass a
strorbytesto theResponse(body=...). Then after investigating the code, or type hints in your IDE within Response, you've noticed we take string or bytes, then use Gzip to compress it hence changing to a string.I suspect you went from:
To:
heitorlessa commentedon Jun 8, 2023
Expanded the
compresssection example with an additional route usingResponseas the return. PR incominggithub-actions commentedon Jun 9, 2023
This issue is now closed. Please be mindful that future comments are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.
github-actions commentedon Jun 16, 2023
This is now released under 2.17.0 version!