Created
November 26, 2012 19:53
-
-
Save sigmavirus24/4150241 to your computer and use it in GitHub Desktop.
zen collection
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
from github3 import login, GitHubError | |
import os | |
import time | |
def collect_zen(sleep_time): | |
g = login(os.environ.get('GHUSER'), os.environ.get('GHPASS')) | |
zen_cache = set() | |
while g.ratelimit_remaining > 1: | |
try: | |
zen_cache.add(g.zen()) | |
except GitHubError: | |
break | |
time.sleep(sleep_time) | |
return zen_cache |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment