Ejemplo n.º 1
0
def add_tweet(tweet_info):
    lat = None
    lng = None
    if tweet_info['coordinates']:
        lat = float(tweet_info['coordinates']['coordinates'][0])
        lng = float(tweet_info['coordinates']['coordinates'][1])
        
    new_tweet = Tweet()
    new_tweet.uid = tweet_info['user']['id']
    new_tweet.tid = tweet_info['id']
    new_tweet.text = Thumbs.genThumbs(tweet_info['text'])
    if lat and lng:
        new_tweet.lat = lat
        new_tweet.lng = lng
    new_tweet.time = datetime.strptime(tweet_info['created_at'], "%a %b %d %H:%M:%S +0000 %Y")

    new_tweet.put()
Ejemplo n.º 2
0
def add_tweet(tweet_info):
    if Tweet.isStored(tweet_info['id']):
        raise TweetAlreadyStoredException

    lat = None
    lng = None
    if tweet_info['coordinates']:
        lat = float(tweet_info['coordinates']['coordinates'][0])
        lng = float(tweet_info['coordinates']['coordinates'][1])
        
    new_tweet = Tweet()
    new_tweet.uid = tweet_info['user']['id']
    new_tweet.tid = tweet_info['id']
    new_tweet.text = tweet_info['text']
    if lat and lng:
        new_tweet.lat = lat
        new_tweet.lng = lng
    new_tweet.time = datetime.strptime(tweet_info['created_at'], "%a %b %d %H:%M:%S +0000 %Y")

    new_tweet.put()
Ejemplo n.º 3
0
def add_tweet(tweet_info):
    if Tweet.isStored(tweet_info['id']):
        raise TweetAlreadyStoredException

    lat = None
    lng = None
    if tweet_info['coordinates']:
        lat = float(tweet_info['coordinates']['coordinates'][0])
        lng = float(tweet_info['coordinates']['coordinates'][1])

    new_tweet = Tweet()
    new_tweet.uid = tweet_info['user']['id']
    new_tweet.tid = tweet_info['id']
    new_tweet.text = tweet_info['text']
    if lat and lng:
        new_tweet.lat = lat
        new_tweet.lng = lng
    new_tweet.time = datetime.strptime(tweet_info['created_at'],
                                       "%a %b %d %H:%M:%S +0000 %Y")

    new_tweet.put()