Skip to content

0.2.0

Compare
Choose a tag to compare
@uclatommy uclatommy released this 27 Feb 00:57
· 73 commits to master since this release

The following features were added:

  • Additional pos, neu, and neg dimensions added to tweet data
  • Datetime is now stored in data as a datetime object rather than string
  • Tweetfeels will now attempt to reconnect to twitter when the connection is interrupted
  • Improved data handling for stream data.

This release changes the format of the sqlite3 database which keeps the history of all tweets. As a result, you will need to convert any databases that were created with the 0.1 version. This can be done like so:

from tweetfeels import TweetData, Tweet
import time

def to_dict(row):
    ts = time.strftime('%a %b %d %H:%M:%S +0000 %Y', row.created_at.to_pydatetime().timetuple())
    return {
        'id_str': row.id_str, 'created_at':ts, 'text':row.text,
        'favorite_count':str(row.favorite_count), 'favorited':str(row.favorited),
        'lang':'en', 'retweet_count':str(row.retweet_count), 'source':row.source,
        'user':{'friends_count':str(row.friends_count), 'followers_count':str(row.followers_count),
        'location':row.location}
        }

if __name__ == "__main__":
    old_db = TweetData('feels-0.1.sqlite')
    new_db = TweetData('feels-0.2.sqlite')

    for df in old_db.all:
        for row in df.itertuples():
            t = Tweet(to_dict(row))
            new_db.insert_tweet(t)

Update the filenames for the old_db and new_db accordingly.