Skip to content

Instantly share code, notes, and snippets.

@doomsuckle
doomsuckle / generic_producer.py
Created October 7, 2015 18:04
generic producer
"""
producer-ish template that assumes AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY are set.
hard-codes the name of the stream in here... but is configurable
needs some re-try logic and doesn't necessarily care what kind of stream you write to
takes a JSON post on the /post route,
validates that it's JSON,
attaches a UTC datetime and uuid to the event and an md5 of the JSON
writes the whole blob to the stream (can be written as
truth to s3 as a record with clumping to happen later)