def build(message_data, message_group_id=None): data = json.dumps(message_data, sort_keys=True) msg = {"Id": hash(data), "MessageBody": data} if message_group_id: msg["MessageGroupId"] = str(message_group_id) return msg
def build(record_data): data = json.dumps(record_data, sort_keys=True) return {"Data": data, "PartitionKey": utils.hash(data)}
def test_kinesis_hash(): hash = utils.hash(json.dumps({"foo": "bar"}, sort_keys=True)) assert isinstance(hash, str) and len(hash) > 0