def streamversion(): """ The main program using stream API """ # Argument parsing args = args_parse() # Twitter session initialisation twit_app = Twitter() # Twitter search tweets_stream = twit_app.streamgeotweets(args.hashtag) search_results = twit_app.get10geotweetsfromstream(tweets_stream) tweets_list_sorted = tweetstream_arrange_by_distance_from_paris(search_results) for i in tweets_list_sorted : print "TWEET: %s\nDISTANCE: %skm"%(i['tweet']["text"],i['distance'])
def searchversion(): """ The main program using Search API """ # Argument parsing args = args_parse() # Twitter session initialisation twit_app = Twitter() # Twitter search tweets_search = twit_app.searchgeotweets(args.hashtag) # Distances tweets_list_sorted = tweetsearch_arrange_by_distance_from_paris(tweets_search) for compte,i in enumerate(tweets_list_sorted) : if compte < 10: print "TWEET: %s\nDISTANCE: %skm"%(i['tweet'].text,i['distance'])