|
|
|
@ -287,6 +287,16 @@ class Connection(NetworkBase):
|
|
|
|
|
option='secure_server_url', |
|
|
|
|
default='https://api.twitter.com/1', |
|
|
|
|
is_cmd_option=False) |
|
|
|
|
options.add_option( |
|
|
|
|
group=self.NAMESPACE, |
|
|
|
|
option='page_size', |
|
|
|
|
default=20, |
|
|
|
|
is_cmd_option=False) |
|
|
|
|
options.add_option( |
|
|
|
|
group=self.NAMESPACE, |
|
|
|
|
option='message_threshold', |
|
|
|
|
default=4, |
|
|
|
|
is_cmd_option=False) |
|
|
|
|
auth_options(self.NAMESPACE, options, self.AUTH) |
|
|
|
|
return |
|
|
|
|
|
|
|
|
@ -295,7 +305,7 @@ class Connection(NetworkBase):
|
|
|
|
|
last_id = int(self._options[self.NAMESPACE][config_var]) |
|
|
|
|
_log.debug('%s: %d', config_var, last_id) |
|
|
|
|
|
|
|
|
|
params = {} |
|
|
|
|
params = {'count': self._options[self.NAMESPACE]['page_size']} |
|
|
|
|
|
|
|
|
|
if last_id > 0: |
|
|
|
|
params['since_id'] = last_id |
|
|
|
@ -327,9 +337,17 @@ class Connection(NetworkBase):
|
|
|
|
|
if top_tweet_id > high_id: |
|
|
|
|
high_id = top_tweet_id |
|
|
|
|
|
|
|
|
|
result.extend(_make_datetime(response)) |
|
|
|
|
response_data = _make_datetime(response) |
|
|
|
|
result.extend(response_data) |
|
|
|
|
page += 1 # Request the next page |
|
|
|
|
|
|
|
|
|
_log.debug('%d messages, %d threshold' % (len(response_data, |
|
|
|
|
self._options[self.NAMESPACE]['message_threshold']))) |
|
|
|
|
|
|
|
|
|
if (len(response_data) <= |
|
|
|
|
self._options[self.NAMESPACE]['message_threshold']): |
|
|
|
|
break |
|
|
|
|
|
|
|
|
|
if last_id == 0: |
|
|
|
|
# do not try to download everything if we don't have a |
|
|
|
|
# previous list (or we'll blow the available requests in one |
|
|
|
|