Exemple #1
0
log = open("mining.log", "a+")
log = csv.writer(log)

for word in key_words:
	for location in locations:

		latitude = location[0]
		longitude = location[1]
		city = location[2]
		search_word = word
		radius = RADIUS
		num_results = NUM_RESULTS


		tweets, tweets_raw = twitter_connection.query(lat=latitude, lng=longitude, search_word=search_word, radius=radius, num_results=num_results)
		number_tweets = len(tweets)


		now = datetime.datetime.now().isoformat().replace(':','-').replace('.','-').replace(':','')
		f_name = "time-{}-{}-{}.DATA".format(now, city, search_word)
		f = open(f_name, 'w+')
		writer  = csv.writer(f)
		for tweet in tweets:
			writer.writerow(tweet)

		print latitude, longitude, search_word,
		print number_tweets, f_name	
		log.writerow([city, search_word, number_tweets, f_name])
		
		f_json_name = "time-{}-{}-{}.json".format(now, city, search_word)