我尝试以编程方式更新 Jenkins 作业的配置,python Jenkins api看起来不错,但由于 HTTP 错误 403(禁止),我无法检索配置:
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
如另一篇 SO post 中所述,在 URL 中添加用户和密码也失败了:
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'
你有什么主意吗 ?