web.py 文件源码

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

项目:Python-IRC-Bot 作者: wolfy1339 项目源码 文件源码
def main():
    iplow = ip2long('192.30.252.0')
    iphigh = ip2long('192.30.255.255')
    if request.remote_addr in range(iplow, iphigh):
        payload = request.get_json()
        if payload["repository"]["name"] == "Python-IRC-Bot":
            try:
                subprocess.check_call(["git", "pull"])
            except subprocess.CalledProcessError:
                irc.privmsg("##wolfy1339", "git pull failed!")
            else:
                if "handlers.py" in payload['head_commit']['modified']:
                    reload_handlers(bot)
            return flask.Response("Thanks.", mimetype="text/plain")
        return flask.Response("Wrong repo.", mimetype="text/plain")
    else:
        flask.abort(403)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号