【发布时间】:2020-08-10 00:52:35
【问题描述】:
我正在使用 request 和 beautifulsoup 的组合在 python 中开发网络抓取程序。 不幸的是,我遇到了 403 问题(即使使用 header)。 这是我的代码:
from bs4 import BeautifulSoup
from requests import get
headers_m = ({'User-Agent':
'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2228.0 Safari/537.36'})
sapo_m = "https://www.idealista.it/vendita-case/milano-milano/"
response_m = get(sapo_m, headers=headers_m)
【问题讨论】:
-
这是你的完整代码吗?
-
显然不是,只是网页端试图“进入”的部分。
标签: python web-scraping beautifulsoup request