Что такое request.exceptions.ConnectionError в запросах python?

Что означает следующая ошибка?

socket.timeout: The read operation timed out 
During handling of the above exception, another exception occurred:
requests.packages.urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='', port=443): Read
timed out. 
During handling of the above exception, another exception occurred:
requests.exceptions.ConnectionError:
HTTPSConnectionPool(host='', port=443): Read timed out.

Вот мой код:

def get(url):
    while True:
        try:
            response = session.get(url, timeout=.5).text
            break
        except requests.exceptions.ReadTimeout:
            new_session()
    return response

r = get(url)

куда session это сеанс, который я сделал и new_session() закрывает этот сеанс и устанавливает сеанс на новый сеанс через requests.session()

0 ответов

Другие вопросы по тегам