2

What does the following error mean?

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.

Here is my code:

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)

Where session is a session that I've made and new_session() closes that session and set session to a new session via requests.session()

Mr.Zeus
  • 424
  • 8
  • 25
tgwtdt
  • 362
  • 2
  • 15

0 Answers0