gpt4 book ai didi

Python jenkinsapi 忽略证书

转载 作者:太空宇宙 更新时间:2023-11-03 14:08:12 29 4
gpt4 key购买 nike

最近,我将 jenkins 转为 https。这是我使用 jenkinsapi 的代码:

import jenkinsapi
from jenkinsapi.jenkins import Jenkins
from jenkinsapi.utils.requester import Requester
import requests
url = 'https://jenkinsd:443'
username = 'MyUser'
password = '123'
requests.packages.urllib3.disable_warnings()
jenkins = Jenkins(url, username, password)
jobs = jenkins.get_jobs()
for jobName in jobs:
print(jobName)

我收到这个错误:

requests.exceptions.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:600)

我试过:

jenkins = Jenkins(url, requester=Requester(username, password, baseurl=url, ssl_verify=False))

或者:

jenkins = jenkinsapi.jenkins.Jenkins(url, username, password, requester =Requester(username, password, ssl_verify=False))

我收到这个错误:

File "D:\Python34\lib\site-packages\requests-2.7.0-py3.4.egg\requests\adapters.py", line 415, in send
raise ConnectionError(err, request=request)
requests.exceptions.ConnectionError: ('Connection aborted.', ConnectionRefusedError(10061, 'No connection could be made because the target machine actively refused it', None, 10061, None))

请指教:)

最佳答案

解决了..

jenkins = Jenkins(url, 用户名, 密码, ssl_verify=False)

更正 url 后:管理 Jenkins > 配置系统 > Jenkins URL

jenkinsapi 现在可以工作了。

https://github.com/pycontribs/jenkinsapi/blob/master/doc/source/ssl_certificate_verification

谢谢!

关于Python jenkinsapi 忽略证书,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41701396/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com