def stop_stream(): """ Stop the current sentiment analysis. """ tweetCtrl = TweetController(server) tweetCtrl.stop_stream() return "steam stopped"
def status(): """ Returns the current status of the sentiment analysis (id, status, tweets_analyzed, avg_mood, pos_tweets, neg_tweets, neu_tweets). """ tweetCtrl = TweetController(server) ret = jsonstruct.encode(tweetCtrl.get_status()) return Response(response=ret, status=200, mimetype="application/json")
def start_stream(): """ Start a new sentiment analysis with the given keywords. Uses the Twitter stream api. """ keywords = [] keywords.append(urllib.unquote(request.args.get('keyword')).decode('utf8')) tweetCtrl = TweetController(server) tweetCtrl.start_stream(keywords=keywords) return "stream started"
def hello(): tweetCtrl = TweetController() tweetCtrl.start_stream(keywords=["#LIVMUN"]) return "Good game, retrieved tweets for 10 seconds"