Skip to content

Instantly share code, notes, and snippets.

View jamescmacey's full-sized avatar

James Macey jamescmacey

View GitHub Profile
@twratl
twratl / AWS SES Email Parser in Lambda
Last active November 14, 2023 14:54
Sample Python Lambda code for parsing emails delivered to S3 buckets via SES and then Lambda invocation from SES - untested
# content provided as part of thread here: https://www.reddit.com/r/aws/comments/cffmxr/how_do_you_strip_the_attachments_from_aws_sessns/
from email.parser import BytesParser
from email import policy
import os
# event will be JSON from SES incoming email rule - NOT an S3 PUT event
def lambda_handler(event, context):
try:
ses_mail = event['Records'][0]['ses']['mail']
@rlucioni
rlucioni / senate-vote-graph.py
Last active August 10, 2022 08:59
Senate Vote Scraper and Graph Builder
import json
from itertools import combinations
import requests
import networkx as nx
def get_senate_vote(vote):
# Year can be replaced to fetch votes from different years (e.g., 2013). 1989 is used
# as an example.