R
R
r4khic2019-09-03 12:23:59
Python
r4khic, 2019-09-03 12:23:59

Socket.gaierror: [Errno 11001] getaddrinfo failed?

I welcome everyone! I'm parsing this resource
. This is the error that comes out:

Mistake
Traceback (most recent call last):
  File "C:\Users\Администратор\AppData\Local\Programs\Python\Python37-32\lib\site-packages\urllib3\connection.py", line 160, in _new_conn
    (self._dns_host, self.port), self.timeout, **extra_kw)
  File "C:\Users\Администратор\AppData\Local\Programs\Python\Python37-32\lib\site-packages\urllib3\util\connection.py", line 57, in create_connection
    for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM):
  File "C:\Users\Администратор\AppData\Local\Programs\Python\Python37-32\lib\socket.py", line 748, in getaddrinfo
    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno 11001] getaddrinfo failed

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\Администратор\AppData\Local\Programs\Python\Python37-32\lib\site-packages\urllib3\connectionpool.py", line 603, in urlopen
    chunked=chunked)
  File "C:\Users\Администратор\AppData\Local\Programs\Python\Python37-32\lib\site-packages\urllib3\connectionpool.py", line 344, in _make_request
    self._validate_conn(conn)
  File "C:\Users\Администратор\AppData\Local\Programs\Python\Python37-32\lib\site-packages\urllib3\connectionpool.py", line 843, in _validate_conn
    conn.connect()
  File "C:\Users\Администратор\AppData\Local\Programs\Python\Python37-32\lib\site-packages\urllib3\connection.py", line 316, in connect
    conn = self._new_conn()
  File "C:\Users\Администратор\AppData\Local\Programs\Python\Python37-32\lib\site-packages\urllib3\connection.py", line 169, in _new_conn
    self, "Failed to establish a new connection: %s" % e)
urllib3.exceptions.NewConnectionError: <urllib3.connection.VerifiedHTTPSConnection object at 0x042CA350>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\Администратор\AppData\Local\Programs\Python\Python37-32\lib\site-packages\requests\adapters.py", line 449, in send
    timeout=timeout
  File "C:\Users\Администратор\AppData\Local\Programs\Python\Python37-32\lib\site-packages\urllib3\connectionpool.py", line 641, in urlopen
    _stacktrace=sys.exc_info()[2])
  File "C:\Users\Администратор\AppData\Local\Programs\Python\Python37-32\lib\site-packages\urllib3\util\retry.py", line 399, in increment
    raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='timeskz.kzhttps', port=443): Max retries exceeded with url: //timeskz.kz/58591-kak-budut-snizhat-ceny-na-aviabilety-rasskazal-kasymbek.html (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x042CA350>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:/Users/Администратор/PycharmProjects/Task/parser.py", line 132, in <module>
    call_all_func(resources)
  File "C:/Users/Администратор/PycharmProjects/Task/parser.py", line 113, in call_all_func
    item_page = get_html(resource_link)
  File "C:/Users/Администратор/PycharmProjects/Task/parser.py", line 15, in get_html
    r = requests.get(url)
  File "C:\Users\Администратор\AppData\Local\Programs\Python\Python37-32\lib\site-packages\requests\api.py", line 75, in get
    return request('get', url, params=params, **kwargs)
  File "C:\Users\Администратор\AppData\Local\Programs\Python\Python37-32\lib\site-packages\requests\api.py", line 60, in request
    return session.request(method=method, url=url, **kwargs)
  File "C:\Users\Администратор\AppData\Local\Programs\Python\Python37-32\lib\site-packages\requests\sessions.py", line 533, in request
    resp = self.send(prep, **send_kwargs)
  File "C:\Users\Администратор\AppData\Local\Programs\Python\Python37-32\lib\site-packages\requests\sessions.py", line 646, in send
    r = adapter.send(request, **kwargs)
  File "C:\Users\Администратор\AppData\Local\Programs\Python\Python37-32\lib\site-packages\requests\adapters.py", line 516, in send
    raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='timeskz.kzhttps', port=443): Max retries exceeded with url: //timeskz.kz/58591-kak-budut-snizhat-ceny-na-aviabilety-rasskazal-kasymbek.html (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x042CA350>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed'))

Process finished with exit code 1


As I understand that the error lies here
# < Получаем html код.
def get_html(url):
    try:
        r = requests.get(url)
        return r.text
    except requests.exceptions.TooManyRedirects:
        pass

How to fix it ? Where to begin ?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Stanislav Pugachev, 2019-09-03
@Stqs

Ivan ,
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='timeskz.kzhttps', port=443): Max retries exceeded with url: //timeskz.kz/58591-kak-budut-snizhat-ceny-na-aviability-rasskazal-kasymbek .html (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 11001] getaddrinfo failed'))
what kind of host is this 'timeskz.kzhttps'?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question