Skip to content

Instantly share code, notes, and snippets.

View bsmth's full-sized avatar
🎯
Back on track

Brian Thomas Smith bsmth

🎯
Back on track
View GitHub Profile
@bsmth
bsmth / s3tosns.py
Last active November 13, 2019 12:43
Python Lambda which reads events from S3 and fans out messages to SNS based on content.
import csv
import json
import urllib.parse
import boto3
s3 = boto3.client('s3')
sns = boto3.client('sns')
def lambda_handler(event, context):
@bsmth
bsmth / json_flatten.py
Last active November 15, 2019 09:48
Small Python script to flatten JSON which is useful in AWS lambdas occasionally
'''
Originally found in https://towardsdatascience.com/flattening-json-objects-in-python-f5343c794b10
edited to shorten key names as far as possible.
'''
import json
json_example = {
"glossary": {
"title": "example glossary",