-
Notifications
You must be signed in to change notification settings - Fork 97
Added Python Handler file for Lambda Kinesis Integration #100
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
import json | ||
import boto3 | ||
def lambda_handler(event, context): | ||
kinesis = boto3.client('kinesis') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
kinesis client initialised but not used. Remove.
print(f"An error occurred {e}") | ||
raise e | ||
print(f"Successfully processed {len(event['Records'])} records.") | ||
def get_record_data(payload): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't need a separate function for just decoding. This can be pulled into handler logic.
print(f"Successfully processed {len(event['Records'])} records.") | ||
def get_record_data(payload): | ||
data = base64.b64decode(payload['data']).decode('utf-8') | ||
# Placeholder for actual async work, you can use asyncio or threading for that |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't see need to recommend asyncio or threading. Remove comment.
@@ -0,0 +1,19 @@ | |||
import base64 | |||
import json |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Import not used. Remove.
@@ -0,0 +1,19 @@ | |||
import base64 | |||
import json | |||
import boto3 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove import. See comment for kinesis client below.
Updated main.py as per the review suggestion. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested code, looks good.
Thanks for the review, will merge this in now. |
*Issue #, if available: #101
*Description of changes: Added Python Handler file for Lambda Kinesis Integration
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.