def test_paging_iterator(self): pager = TwitterAPI.TwitterRestPager(self.api, 'search/tweets', {'q': 'pizza'}) self.assertIsInstance(pager, TwitterAPI.TwitterRestPager) it = pager.get_iterator() self.use_iterator(it)
file_id = open(filename_id, 'r') if os.stat(filename_id).st_size == 0: since_id = '' else: ids = file_id.readlines() since_id = ids[-1] file_id.close() api = TwitterAPI.TwitterAPI(consumer_key=consumer_key, consumer_secret=consumer_secret, auth_type='oAuth2') if since_id: pager = TwitterAPI.TwitterRestPager(api, 'statuses/user_timeline', { 'count': 200, 'screen_name': 'wx_copenhagen', 'since_id': since_id }) else: pager = TwitterAPI.TwitterRestPager(api, 'statuses/user_timeline', { 'count': 200, 'screen_name': 'wx_copenhagen' }) def process_tweet(file, tweet): file.write(tweet + '\n') i = 0 last_id = 0