this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Create tables for --since tracking, refs #39

+21
+2
tests/test_save_tweets.py
··· 37 37 "users_fts_docsize", 38 38 "media", 39 39 "media_tweets", 40 + "since_id_types", 41 + "since_ids", 40 42 } == set(db.table_names()) 41 43 # And check for indexes 42 44 following_indexes = {tuple(i.columns) for i in db["following"].indexes}
+19
twitter_to_sqlite/utils.py
··· 14 14 # Twitter API error codes 15 15 RATE_LIMIT_ERROR_CODE = 88 16 16 17 + SINCE_ID_TYPES = { 18 + "user": 1, 19 + "home": 2, 20 + "mentions": 3, 21 + "search": 4, 22 + } 23 + 17 24 source_re = re.compile('<a href="(?P<url>.*?)".*?>(?P<name>.*?)</a>') 18 25 19 26 ··· 267 274 db["following"].create_index(["followed_id"]) 268 275 if ("follower_id",) not in following_indexes: 269 276 db["following"].create_index(["follower_id"]) 277 + 278 + # Tables for tracking --since 279 + if "since_ids" not in table_names: 280 + db["since_id_types"].create({"id": int, "name": str,}, pk="id") 281 + db["since_id_types"].insert_all( 282 + [{"id": id, "name": name} for name, id in SINCE_ID_TYPES.items()] 283 + ) 284 + db["since_ids"].create( 285 + {"type": int, "key": str, "since_id": int}, 286 + pk=("type", "key"), 287 + foreign_keys=(("type", "since_id_types", "id"),), 288 + ) 270 289 271 290 272 291 def save_tweets(db, tweets, favorited_by=None):