bitbucket.py 文件源码

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

项目:concourse-resource-bitbucket 作者: Karunamon 项目源码 文件源码
def post_result(url, user, password, verify, data, debug):
    r = requests.post(
        url,
        auth=HTTPBasicAuth(user, password),
        verify=verify,
        json=data
        )

    if debug:
        err("Request result: " + str(r))

    if r.status_code == 403:
        err("HTTP 403 Forbidden - Does your bitbucket user have rights to the repo?")
    elif r.status_code == 401:
        err("HTTP 401 Unauthorized - Are your bitbucket credentials correct?")

    # All other errors, just dump the JSON
    if r.status_code != 204:  # 204 is a success per Bitbucket docs
        err(json_pp(r.json()))

    return r

# Stop all this from executing if we were imported, say, for testing.
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号