【发布时间】:2020-11-10 04:27:26
【问题描述】:
有人可以帮助我吗?我在尝试使用 BeautifulSoup 进行抓取时遇到这些错误,
from bs4 import BeautifulSoup as soup
from urllib.request import urlopen as uReq
myUrl = "https://www.tokopedia.com/discovery/produk-terlaris?source=homepage.top_carousel.0.38454"
#open the connection
uClient = uReq(myUrl)
page_html = uClient.read()
uClient.close()
page_soup = soup(page_html,"html.parser")
product = page_soup.findAll("div", {"class": "css-6bc98m e1uv83qc1"})
print(len(product))
这是错误
Traceback (most recent call last):
....
....
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/ssl.py", line 911, in read
return self._sslobj.read(len, buffer)
ConnectionResetError: [Errno 54] Connection reset by peer
【问题讨论】: