コード例 #1
0
 def fetch_status_id_from_db():
     """a generator which generates 100 id list at a time"""
     count = 0
     result = list()
     for id, in Connection.sql_execute(
             f"SELECT id FROM records WHERE user_id IS NULL order by create_at desc"
     ):
         count += 1
         result.append(id)
         if count >= 100:
             yield result
             time.sleep(20)
             # set sleep time to prevent the twitter api from being banned
             result.clear()
             count = 0
コード例 #2
0
 def get_exists(self) -> set:
     """gets how far we went last time"""
     return set(Connection.sql_execute(self.select_exists))