Skip to content

Instantly share code, notes, and snippets.

@Nickfost
Last active August 29, 2015 14:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Nickfost/f30032deda1d0b14bb97 to your computer and use it in GitHub Desktop.
Save Nickfost/f30032deda1d0b14bb97 to your computer and use it in GitHub Desktop.
## 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