Я пытался очистить страницу с помощью красивого супа (bs4), но я столкнулся с проблемой при очистке данных, я даже упомянул заголовки, как указано в этом ответе Stackoverflow Question Это мой код
from bs4 import BeautifulSoup
import requests
headers = {
'Referer': 'hello',
}
r=requests.get
('https://www.doamin.com/bangalore/restaurants',headers=headers)
print(r.status_code)
это ошибка, которую я получаю
requests.exceptions.ConnectionError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response',))
, и это
raise RemoteDisconnected("Remote end closed connection without"
http.client.RemoteDisconnected: Remote end closed connection without
response
Я даже пытался использовать useragents
import requests
url = 'https://www.example.com/bangalore/restaurants'
headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36
(KHTML, like Gecko) Chrome/41.0.2228.0 Safari/537.36'}
response = requests.get(url, headers=headers)
print(response.content)
Но все равно получаю ту же ошибку!
Кто-нибудь может мне помочь?