Jenkins登录错误使用python jenkins(Cloudbees Jenkins)

Jenkins login error using python jenkins (Cloudbees Jenkins)

1
2
3
4
5
import jenkins

jen = jenkins.Jenkins(url="https://us1****xhpu******************.com:9080/" ,username="sk******", password="00326aef7*******************15695")

print jen.get_whoami()

注意:密码是API令牌

错误:

requests.exceptions.SSLError:
HTTPSConnectionPool(host='**********************', port=9080): Max
retries exceeded with url: /crumbIssuer/api/json (Caused by
SSLError(SSLError(1, u'[SSL: CERTIFICATE_VERIFY_FAILED] certificate
verify failed (_ssl.c:590)'),))

我尝试了https→http,但没有成功。


以下代码有效

1
2
3
4
5
import jenkins
import os
os.environ.setdefault("PYTHONHTTPSVERIFY","0")
jen = jenkins.Jenkins(url="https://<hostname>:9080/" ,username="user", password="<password/API token>")
print jen.get_whoami()