我正在尝试使用代理抓取网站,但我收到了错误消息。我还在学习,所以你的意见将非常有用。
这是我的代码:
hdr = {
"Accept-Language": "en-US,en;q=0.5",
"Connection": "keep-alive"
}
proxies = {'http': 'http://user:pass@us-wa.proxymesh.com:11111', 'https': 'http://user:pass@us-wa.proxymesh.com:11111'}
try:
page = BeautifulSoup(urllib2.urlopen(urllib2.Request(urltocrawl_b,headers=hdr,proxies=proxies), timeout=7),'lxml')
except :
print "-----------------ERROR ---------------------"
我得到的错误是:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: __init__() got an unexpected keyword argument 'proxies'
谢谢!