【问题标题】:Python Requests Tableau REST API SSL ErrorsPython 请求 Tableau REST API SSL 错误
【发布时间】:2017-09-16 16:33:42
【问题描述】:

我不太熟悉证书的工作原理,所以我可能在做一些愚蠢的事情,提前道歉。

我正在尝试与 tableau 的 REST API 进行交互,并使用安全连接进行交互,因为他们的某些调用需要这样做。

但是,我在创建连接时遇到了各种错误。

我能够创建不安全的连接:

requests.get('https://tableau.mynetwork.lan', verify = False)
<Response [200]>

我还能够与 google 建立安全连接:

requests.get('https://google.com', verify = True)
<Response [200]>

但是,尝试创建与我的 tableau 服务器的安全连接:

requests.get('https://tableau.mynetwork.lan', verify = True)

或:

requests.get('https://tableau.mynetwork.lan', verify = certifi.old_where())

导致以下错误:

SSLError: ("bad handshake: Error([('SSL routines', 'ssl3_get_server_certificate', 'certificate verify failed')],)",)

我的本​​地计算机上有我的 tableau 服务器证书,并尝试通过 cert 参数传递它们:

tableau_cert = r"C:\tabcert.cer"
requests.get('https://tableau.mynetwork.lan', cert=tableau_cert, verify = True)

但是得到这个错误:

Error: [('PEM routines', 'PEM_read_bio', 'no start line'), ('SSL routines', 'SSL_CTX_use_certificate_file', 'PEM lib')]

有人指点一下吗?

【问题讨论】:

    标签: python rest ssl tableau-api


    【解决方案1】:

    我的本​​地计算机上有我的 tableau 服务器证书,并尝试通过 cert 参数传递它们:

    requests.get('https://tableau.mynetwork.lan', cert=tableau_cert, verify = True)
    

    cert 是指定 CA 的错误参数。 according to the documentation的正确做法是将你的CA文件的路径设置为verify参数的值:

    requests.get('https://tableau.mynetwork.lan', verify=tableau_cert)
    

    另外,请确保您拥有的文件是正确的PEM encoded

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2013-05-09
      • 2021-03-31
      • 2018-11-01
      • 2014-05-04
      • 2015-08-30
      • 2018-02-03
      • 1970-01-01
      相关资源
      最近更新 更多