Ошибка HTTP Error 307: The HTTP server returned a redirect error that would lead to an infinite loop
Люди добрые, помогите. У меня возникла ошибка.
Вот код:
from bs4 import BeautifulSoup
from urllib.request import urlopen
url = "https://fasie.ru/programs/"
page = urlopen(url)
html = page.read().decode("utf-8")
soup = BeautifulSoup(html, "html.parser")
div = soup.find_all('div', class_ = 'wrap')
programms_list = div[1].find('ul', class_='').find_all('ul', class_='')[1]
hrefs = programms_list.find_all('a')
for h in hrefs:
url_h = f"https://fasie.ru{h.get('href')}"
page_h = urlopen(url_h)
html_h = page_h.read().decode("utf-8")
soup_h = BeautifulSoup(html_h, "html.parser")
sections = soup_h.find_all('section')
for s in sections:
print(s.text)
И тут у меня возникает вот такая ошибка. Причём для любого кода.
urllib.error.HTTPError: HTTP Error 307: The HTTP server returned a redirect error that would lead to an infinite loop.
The last 30x error message was:
Temporary Redirect
Что делать? В чём дело? Помогите, прошу вас.