2017-08-29 274 views
0

我試圖從網站上抓取數據,我給了用戶名和密碼,但仍然給我以下錯誤。Spyder - 網頁抓取

"URLError: urlopen error [Errno 11004] getaddrinfo failed>" 

這裏是我的代碼:

import urllib.request as req 

proxy = req.ProxyHandler({'http':r'http://abca:[email protected]@:192.168.115.116:8080'})  
auth = req.HTTPBasicAuthHandler()  
opener = req.build_opener(proxy, auth, req.HTTPHandler) 

req.install_opener(opener)  
conn = req.urlopen('http://www.google.com') 

return_str = conn.read() 

感謝&問候, 桑傑

回答

0

URL 101

人物應該用百分之編碼時,特別是結腸和@ -sign因爲它們是語法的一部分。