这已经在这里提到过了,我试图通过一个假的用户周界,但没有用。你能帮忙吗
import requests
from bs4 import BeautifulSoup
headers = requests.utils.default_headers()
headers.update({
'User-Agent': 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0',
})
page = requests.get('https://ingatlan.com/lista/elado+lakas')
soup = BeautifulSoup(page.content, 'html.parser')
print(soup.prettify())
错误消息如下所示:
$ python hello.py
<html>
<head>
<title>
403 Forbidden
</title>
</head>
<body>
<center>
<h1>
403 Forbidden
</h1>
</center>
<hr/>
<center>
nginx
</center>
</body>
</html>
它的反应很明显
相关问题 更多 >
编程相关推荐