我正在努力与https网站和文件建立联系。我们有ntlm网络代理身份验证。 HTTP连接像魅力一样工作,但https仍然存在错误:
pycurl.error: (27, "SSL: couldn't create a context: error:140A90A1:lib(20):func(169):reason(161)")
我尝试将verifypeer设置为0,但它不起作用,与conn.setopt(pycurl.SSL_CIPHER_LIST, 'rsa_rc4_128_sha')
相同。我想下载:https://nbp.pl/kursy/xml/LastA.xml。任何线索?
代码:
conn=pycurl.Curl()
conn.setopt(pycurl.URL, url)
conn.setopt(pycurl.PROXY, proxy)
conn.setopt(pycurl.PROXYPORT,8080)
conn.setopt(pycurl.HTTPAUTH, pycurl.HTTPAUTH_NTLM)
conn.setopt(pycurl.PROXYUSERPWD, user)
conn.setopt(pycurl.WRITEFUNCTION, open(r'xml\\'+name+'.'+extension,'w+').write)
conn.perform()
conn.close()
答案 0 :(得分:0)
使用CNTLM获得旁路成功。
代码:
proxy = urllib2.ProxyHandler({'https':'127.0.0.1:3128'})
opener = urllib2.build_opener(proxy)
urllib2.install_opener(opener)
u = urllib2.urlopen(url)
data = u.read()
fil=open(r'xml\\'+name+'.'+extension,'w+')
fil.write(data)