Код: Выделить всё
url = booklink[0].replace('/index.html', '/page' + str(pages) + '.html')
req = Request(url,headers={'User-Agent': 'Mozilla/5.0'})
page = urlopen(req).read()
htm = BeautifulSoup(page, 'html.parser')
html = htm.prettify()
Я уже пробовал такие вещи, как:
Код: Выделить всё
response = requests.get(url, stream=True)
soup = BeautifulSoup(response.raw.read(), 'html.parser')
Код: Выделить всё
with urllib.request.urlopen(url) as response:
source_code = response.read().decode('utf-8')
Как мне заставить программу убедиться, что вся веб-страница загружена, прежде чем она попытается ее очистить?>
Подробнее здесь: https://stackoverflow.com/questions/798 ... examine-it
Мобильная версия