コード例 #1
0
ファイル: server.py プロジェクト: danpalmer/Shockwave
def format_twitter_status(status):
	"""Formats tweets into the correct format for delivery to the client
	"""
	# if status['text'].startswith('RT'):
	# 		return None
	
	if not status['geo']:
		return None
	
	print "this works"
	tweet = DataPoint()
	tweet.content = status['text']
	tweet.latitude = status['geo']['coordinates'][0]
	tweet.longitude = status['geo']['coordinates'][1]
	tweet.time = datetime.strptime(status['created_at'], '%a %b %d %H:%M:%S +0000 %Y')
	tweet.tags = map(lambda x: x['text'], status['entities']['hashtags'])
	print "more stuff"
	return tweet.json()
コード例 #2
0
from datetime import datetime
from model import DataPoint

def format_twitter_status(status):
<<<<<<< HEAD
	"""Formats tweets into the correct format for delivery to the client
	"""
	
	if not status['geo']:
		return None
	
	tweet = DataPoint()
	tweet.content = status['text']
	tweet.latitude = status['geo']['coordinates'][0]
	tweet.longitude = status['geo']['coordinates'][1]
	tweet.time = datetime.strptime(status['created_at'], '%a %b %d %H:%M:%S +0000 %Y')
	tweet.tags = map(lambda x: x['text'], status['entities']['hashtags'])
	
	return tweet.json()
=======
	   """Formats tweets into the correct format for delivery to the client
	   """
	   if status['text'].startswith('RT'):
			   return None

	   if not status['geo']:
			   return None

	   tweet = DataPoint()
	   tweet.content = status['text']
	   tweet.latitude = status['geo']['coordinates'](0)