writingprompts.py 文件源码

python
阅读 20 收藏 0 点赞 0 评论 0

项目:reddit-scripts 作者: raymestalez 项目源码 文件源码
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
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号