Jenkins:获取配置时出现HTTP错误403 [英] Jenkins: HTTP error 403 when getting config

查看:2579
本文介绍了Jenkins:获取配置时出现HTTP错误403的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试以编程方式更新Jenkins作业的配置,并且 Python Jenkins api 看起来不错,但由于HTTP错误403(禁止),我无法检索配置:

I try to update Jenkins jobs' config programmatically, and the python Jenkins api looked ok, but I can't retrieve a config because of HTTP error 403 (forbidden):

from jenkinsapi import api
j = api.Jenkins('https://server.test.com/hudson', 'fp12210', 'xxxxxxxx')
job = j.get_job('BBB-100-CheckStatusAll')
conf = job.get_config()

Traceback (most recent call last):
  ...
  File "C:\Python27\lib\urllib2.py", line 521, in http_error_default
    raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
HTTPError: HTTP Error 403: Forbidden

在URL中添加用户和密码,在另一篇SO帖子中提到 ,也失败:

Adding user and password in URL, as mentionned in another SO post, fails too:

 j = api.Jenkins('https://fp12210:xxxxxxxx@server.test.com/hudson')

Traceback (most recent call last):
  ...
  File "build\bdist.win32\egg\jenkinsapi\utils\retry.py", line 39, in retry_function
    raise e
InvalidURL: nonnumeric port: 'xxxxxxxx@server.test.com/hudson'

你有什么主意吗?

推荐答案

This SO post is the solution. I now get an error 500, but this is another story...

这篇关于Jenkins:获取配置时出现HTTP错误403的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆