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.
bitbucket.py 文件源码
python
阅读 26
收藏 0
点赞 0
评论 0
评论列表
文章目录