ganduras381
@ganduras381
Начинаю

Почему не работает http get реквест на единственный сайт?

Реквестит следующая функция:
def simple_get(url):
    """
    Attempts to get the content at `url` by making an HTTP GET request.
    If the content-type of response is some kind of HTML/XML, return the
    text content, otherwise return None.
    """
    try:
        with closing(get(url, stream=True)) as resp:
            if is_good_response(resp):
                return resp.content
            else:
                return None

Используется она вот так:
from mathematicians import simple_get
import os
from bs4 import BeautifulSoup

raw_html = simple_get('https://dictionary.cambridge.org')
html = BeautifulSoup(raw_html, 'html.parser')
print(html)

Возникает ошибка, соответствующая функции:
Error during requests to https://dictionary.cambridge.org/dictionary : ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response'))
Реквест https://vk.com и других сайтов с дополненным протоколом работает, как и сайты с http.
  • Вопрос задан
  • 167 просмотров
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы