我正在努力搜索电子商务网站并搜索其产品。我为其他两个网站做了同样的事情,它在那里工作。但是对于这个我得到了这个错误。
def parse_url(self,url):
hdr = {'User-Agent':'Mozilla/5.0'}
req = urllib2.Request(url,headers=hdr)
res = urllib2.urlopen(req)
data=src.read()
soup=BeautifulSoup(data,"lxml")
return soup
def scrape(self,name):
k=name
url ="http://www.snapdeal.com/search?keyword=" + str(k) + "&santizedKeyword=&catId=&categoryId=175&suggested=true&vertical=p&noOfResults=20&clickSrc=suggested&lastKeyword=&prodCatId=&changeBackToAll=false&foundInAll=false&categoryIdSearched=&cityPageUrl=&url=&utmContent=&catalogID=&dealDetail="
soup=self.parse_url(url)