def handle_stream(self, message):
logging.debug("<STR_LIT>")<EOL>event = Event()<EOL>for line in message.strip().splitlines():<EOL><INDENT>(field, value) = line.split("<STR_LIT::>", <NUM_LIT:1>)<EOL>field = field.strip()<EOL>if field == "<STR_LIT>":<EOL><INDENT>event.name = value.lstrip()<EOL><DEDENT>elif field == "<STR_LIT:data>":<EOL><INDENT>value = value.lstrip()<EOL>if event.data is None:<EOL><INDENT>event.data = value<EOL><DEDENT>else:<EOL><INDENT>event.data = "<STR_LIT>" % (event.data, value)<EOL><DEDENT><DEDENT>elif field == "<STR_LIT:id>":<EOL><INDENT>event.id = value.lstrip()<EOL>self.last_event_id = event.id<EOL><DEDENT>elif field == "<STR_LIT>":<EOL><INDENT>try:<EOL><INDENT>self.retry_timeout = int(value)<EOL>event.retry = self.retry_timeout<EOL>logging.info("<STR_LIT>" % (value,))<EOL><DEDENT>except ValueError:<EOL><INDENT>pass<EOL><DEDENT><DEDENT>elif field == "<STR_LIT>":<EOL><INDENT>logging.debug("<STR_LIT>" % (value,))<EOL><DEDENT>else:<EOL><INDENT>raise Exception("<STR_LIT>")<EOL><DEDENT><DEDENT>self.events.append(event)<EOL>
Acts on message reception
:param message: string of an incoming message

parse all the fields and builds an Event object that is passed to the callback function