You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Python调用Jira Cloud REST API遇SSL证书验证失败求助

解决Jira Cloud API调用SSL证书验证失败问题

错误原因

该错误源于网络环境中存在自签名证书(多为公司代理服务器证书),导致requests库无法验证Jira Cloud的SSL证书链完整性。

可行解决办法

1. 临时跳过SSL验证(仅测试环境可用)

在requests.request调用中添加verify=False参数直接跳过证书验证,生产环境禁止使用,会引发安全风险。

修改后的代码:

import requests
import json

url = "https://your-domain.atlassian.net/rest/agile/1.0/issue/{issueIdOrKey}"

headers = {
  "Accept": "application/json",
  "Authorization": "Bearer <access_token>"
}

response = requests.request(
   "GET",
   url,
   headers=headers,
   verify=False  # 添加此参数
)

print(json.dumps(json.loads(response.text), sort_keys=True, indent=4, separators=(",", ": ")))

2. 添加可信证书(生产环境推荐)

将网络环境中的自签名根证书保存为本地文件(例如company_ca.crt),在请求中指定该证书作为可信来源:

response = requests.request(
   "GET",
   url,
   headers=headers,
   verify="company_ca.crt"  # 替换为你的证书文件路径
)

也可设置环境变量让requests全局使用该证书:

  • Linux/macOS终端:export REQUESTS_CA_BUNDLE="/path/to/company_ca.crt"
  • Windows命令行:set REQUESTS_CA_BUNDLE=C:\path\to\company_ca.crt

3. 更新系统CA证书库

若系统缺少Jira Cloud所需的根证书,可更新系统CA证书:

  • Linux(Debian/Ubuntu):sudo apt update && sudo apt install --reinstall ca-certificates
  • Linux(RHEL/CentOS):sudo yum update ca-certificates
  • Windows:通过"设置-更新和安全"安装系统更新,包含根证书更新
  • macOS:打开"钥匙串访问",导入缺失的根证书并设置为"始终信任"

内容的提问来源于stack exchange,提问作者Devendra Yadav

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.17 11:25:04