Skip to content

Commit 8b2efa5

Browse files
authored
Merge pull request #287 from RichLuna/configurable_pulling_time
Polling time now can be configured in the .rainbow_config.json file
2 parents aa0cb0c + 1fc6ff3 commit 8b2efa5

File tree

3 files changed

+5
-1
lines changed

3 files changed

+5
-1
lines changed

docs/index.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,8 @@ If you would like to specify a different location for your custom config you can
331331

332332
You also can view or set a new value of every config key with the ``config`` command (See **Interactive mode** section above).
333333

334+
- ``POLLING_TIME``: Time in seconds between each automatic poll. Most Twitter accounts have a limit of 15 requests each 15 minutes. If in doubt, set it to 90 or more.
335+
334336
- ``HEARTBEAT_TIMEOUT``: after this timeout (count by minutes), the stream will automatically hangup.
335337

336338
- ``IMAGE_ON_TERM``: display tweet's image directly on terminal.

rainbowstream/colorset/config

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
{
2+
//Time in seconds between each automatic poll. Most Twitter accounts have a limit of 15 requests each 15 minutes. If in doubt, set it to 90 or more.
3+
"POLLING_TIME" : 90,
24
// Turn to 'true' in order to disable extended tweets display (legacy mode)
35
"DISABLE_EXTENDED_TWEETS" : false,
46
// After 120 minutes, the stream will automatically hangup

rainbowstream/rainbow.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2211,7 +2211,7 @@ def stream(domain, args, name='Rainbow Stream'):
22112211
if args.track_keywords:
22122212
query_args['track'] = args.track_keywords
22132213

2214-
polling_time = 90
2214+
polling_time = c['POLLING_TIME']
22152215
while True:
22162216
time.sleep(polling_time)
22172217
poll()

0 commit comments

Comments
 (0)