fishbans.py 文件源码

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

项目:Taigabot 作者: FrozenPigs 项目源码 文件源码
def fishbans(inp):
    "fishbans <user> -- Gets information on <user>s minecraft bans from fishbans"
    user = inp.strip()

    try:
        request = http.get_json(api_url.format(quote_plus(user)))
    except (http.HTTPError, http.URLError) as e:
        return "Could not fetch ban data from the Fishbans API: {}".format(e)

    if request["success"] == False:
        return "Could not fetch ban data for {}.".format(user)

    user_url = "http://fishbans.com/u/{}/".format(user)
    ban_count = request["stats"]["totalbans"]

    return "The user \x02{}\x02 has \x02{}\x02 ban(s). See detailed info " \
           "at {}".format(user, ban_count, user_url)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号