def event_batch_proto(): '''Return a valid event request''' event_request_proto = EventMessage_pb2.BatchEventRequest() event_proto = event_request_proto.events.add() event_proto.user_id = 123 event_proto.event_id = 1 event_proto.event_type = 2 event_proto.timestamp = 12345 # add some parameters pair = event_proto.pairs.add() pair.key = 'some_constant' pair.value = '6' pair = event_proto.pairs.add() pair.key = 'world_id' pair.value = '1' return event_request_proto.SerializeToString()
def init_input_format(self, body): proto_request = EventMessage_pb2.BatchEventRequest() proto_request.ParseFromString(body) return proto_request