Last active
August 29, 2015 14:05
-
-
Save Nickfost/f30032deda1d0b14bb97 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## 15 minute blocks wait exmaple | |
import os | |
from datetime import datetime | |
def wait_for_twitter_limit(): | |
now = datetime.now() | |
issuetime = now.minute | |
if issuetime < 15: | |
goodtime = 30 | |
elif issuetime < 30: | |
goodtime = 45 | |
elif issuetime < 45: | |
goodtime = 59.9 | |
elif issuetime > 45: | |
goodtime = 15 | |
print "Waiting for twitter limit." | |
print "Twitter limit resets at " + str(now.hour) + ":" + str(goodtime) | |
while goodtime > now.minute: | |
time.sleep(60) | |
now = datetime.now() | |
pass | |
print "Great! we waited long enough" | |
wait_for_twitter_limit() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment