def test():
top_posts = get_top_posts(limit=5)
sorted_comments = get_top_comments(top_posts, limit=20)
authors = extract_authors(sorted_comments)
sorted_authors = calculate_karma(authors, limit=50)
write_authors_to_file(sorted_authors)
# Don't accidentally override author's file!!
# def try_until_works(function):
# while True:
# try:
# finction()
# break
# except urllib2.HTTPError, e:
# if e.code in [429, 500, 502, 503, 504]:
# print "Reddit is down (error %s), sleeping..." % e.code
# time.sleep(60)
# pass
# else:
# raise
# except Exception, e:
# print "couldn't Reddit: %s" % str(e)
# raise
评论列表
文章目录