BaseParser is a prototype for Stream Parser objects. All parsers should extend this class.
This method must be overridden. It raises a NotImplementedError.
A simple Stream parser that converts the returned data to JSON and prints tweets.
Converts input data to JSON and calls the tweet method if the input is a tweet.
Input that isn’t a tweet:
>>> parser = DefaultParser()
>>> parser.parse('{"some":"json"}')
Input that would be considered a tweet:
>>> parser.parse('{"for_user":1, "message":{"text":"hi!"}}')
For user 1: hi!
Prints a tweet based on a tweet message and who the user is for.
>>> parser = DefaultParser()
>>> parser.tweet(1, {'text':'hi!'})
For user 1: hi!