Skip to content

Commit

Permalink
Exit While loop instead of hangup all application.
Browse files Browse the repository at this point in the history
  • Loading branch information
orakaro committed Dec 11, 2016
1 parent cc92df2 commit 3d60673
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions rainbowstream/rainbow.py
Original file line number Diff line number Diff line change
Expand Up @@ -938,8 +938,9 @@ def ls():
# 300 users means 15 calls to the related API. The rate limit is 15
# calls per 15mn periods (see Twitter documentation).
if ( number_of_users % 300 == 0 ):
printNicely( '(waiting 16mn for rate limits reasons...)' )
time.sleep(16*60)
printNicely(light_yellow( 'We reached the limit of Twitter API.' ))
printNicely(light_yellow( 'You may need to wait about 15 minutes.' ))
break

printNicely('All: ' + str(number_of_users) + ' ' + d[target] + '.')

Expand Down

2 comments on commit 3d60673

@Lertsenem
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please note that by doing this you will never see more than 300 friends (or followers).

The time.sleep(16*60) was not very nice, but still allowed you to print all your friends eventually.

@orakaro
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Yes I understand. I will try to find more reliable solution but when waiting for it, maybe not let RS hangup is better.

Please sign in to comment.