代理PKI身份验证,python 2.6.6

问题描述 投票:0回答:1

我试图通过代理进行基于PKI的身份验证。它在没有代理的情况下运行良好,但是当我添加代理信息时它返回401错误。

proxies = {
  'http': "http://10.192.72.155:8080",
  'https': "http://10.192.72.155:8080",
}

def open_url(url, key, cert):


    headers = {"User-Agent": "<custom>", "Accept": "<custom>"}
    response = requests.get(url, headers=headers, cert=(cert,key), timeout=300)
    print response.headers, response

open_url("https://api.example.com/product/LatestUpdate", "/usr/bin/dev_certs/test_cert.key", "/usr/bin/dev_certs/test_cert.pem")

以上实现很有效,直到我向requests.get()添加代理

response = requests.get(url, headers=headers, proxies=proxies, cert=(cert,key), timeout=300)

返回以下错误:

HTTP / 1.0 401未经授权 WWW-Authenticate:Basic realm =“” 服务器:SomeServer 连接:保持活跃内容长度:35

ssl urllib2 python-2.6 http-proxy pki
1个回答
0
投票

问题是我的代理设置,它还解密HTTPS流量,因为它没有传递原始证书。我禁用HTTPS解密后,它工作。

© www.soinside.com 2019 - 2024. All rights reserved.