試圖讓這片代碼工作:(網頁抓取使用BeautifulSoup樣品)網頁抓取使用BeauitifulSoup錯誤:[錯誤10061]
import urllib2
wiki = "https://en.wikipedia.org/wiki/List_of_state_and_union_territory_capitals_in_India"
page = urllib2.urlopen(wiki)
from bs4 import BeautifulSoup
soup = BeautifulSoup(page)
我得到這個錯誤: -
URLError: <urlopen error [Errno 10061] No connection could be made because the target machine actively refused it>
我猜測這是與一些防火牆/安全相關的問題,有人可以幫助應該做什麼?
我認爲,你需要設置代理 –
結帳http://stackoverflow.com/questions/1450132/proxy-with-urllib2 –
請求更好地使用 –