【发布时间】:2021-04-24 00:13:24
【问题描述】:
我正在尝试从 G2 抓取客户评论,作为我工作项目的一部分,但收到 403 错误。有什么想法可以解决这个问题吗?
HTTPError:HTTP 错误 403:禁止
from urllib.request import Request, urlopen
req = Request("https://www.g2.com/products/google-drive/reviews", headers={'User-Agent': 'Mozilla/5.0'})
web_byte = urlopen(req).read()
webpage = web_byte.decode('utf-8')
parsed_html = BeautifulSoup(webpage, features="lxml")
【问题讨论】:
标签: python web-scraping