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

运行Tableau API调用server.auth.sign_in时出现SSL证书验证失败错误

解决Tableau API登录时的SSL证书验证失败问题

运行代码with server.auth.sign_in(tableau_auth)时触发以下SSL错误:

requests.exceptions.SSLError: HTTPSConnectionPool(host='tableau.test.wilhelmsen.com', port=443): Max retries exceeded with url: //api/2.4/auth/signin (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1002)')))

此前功能正常,现在登录环节报错,核心原因是本地无法验证Tableau服务器的SSL证书,以下是可行的解决方法:

  • 检查并更新服务器根证书
    大概率是Tableau服务器的SSL证书近期更新,本地信任库未同步新的根证书。用浏览器访问https://tableau.test.wilhelmsen.com,导出网站的根证书(保存为.pem格式),将其添加到系统的证书信任存储,或者Python环境的证书库中。

  • 测试环境临时禁用证书验证(谨慎使用)
    仅限测试场景紧急排查使用,生产环境绝对禁止。修改代码初始化Server对象时添加证书验证关闭的配置:

    server = tableau_server_client.Server('https://tableau.test.wilhelmsen.com')
    server.add_http_options({'verify': False})
    

    该操作会跳过SSL证书验证,存在中间人攻击风险,仅作临时测试用。

  • 指定自定义证书路径
    将导出的根证书放在本地指定路径,代码中指定该路径让requests库验证:

    server = tableau_server_client.Server('https://tableau.test.wilhelmsen.com')
    server.add_http_options({'verify': '/path/to/your/root_certificate.pem'})
    
  • 更新Python环境的证书库
    部分Python环境自带的证书库可能未及时更新,执行以下命令更新certifi包(requests依赖的证书库):

    pip install --upgrade certifi
    

    也可以通过设置环境变量REQUESTS_CA_BUNDLE,让requests指向系统更新后的证书存储路径。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.13 23:43:17