2014-12-02 152 views
0

我正在努力連接到https站點和文件。我們有ntlm網絡代理認證。 HTTP連接的工作就像一個魅力,但HTTPS被套牢錯誤:Pycurl ssl連接通過ntlm

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

嗨@Synal我正在開發一個新的服務做NTLM身份驗證https://www.nafiux.com/wasp/如果我可以幫你,請讓我知道 – 2014-12-11 06:59:16

回答

0

GOT成功使用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)