github_hooks.py 文件源码

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

项目:DevOps 作者: YoLoveLife 项目源码 文件源码
def _create(module, hookurl, oauthkey, repo, user, content_type):
    url = "%s/hooks" % repo
    values = {
        "active": True,
        "name": "web",
        "config": {
            "url": "%s" % hookurl,
            "content_type": "%s" % content_type
            }
        }
    data = json.dumps(values)
    auth = base64.encodestring('%s:%s' % (user, oauthkey)).replace('\n', '')
    headers = {
        'Authorization': 'Basic %s' % auth,
    }
    response, info = fetch_url(module, url, data=data, headers=headers)
    if info['status'] != 200:
        return 0, '[]'
    else:
        return 0, response.read()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号