UrlLib3 MaxRetryError Python 3.6 - PullRequest
       7

UrlLib3 MaxRetryError Python 3.6

0 голосов
/ 13 февраля 2019

Я использую виртуальную среду Python 3.6 с установленным только Urllib3 1.24.1.

Я продолжаю получать MaxRetryError с самыми основными запросами.Я действительно в растерянности относительно того, что здесь происходит.

Вот копия того, что происходит:

Python 3.6.0 (v3.6.0:41df79263a11, Dec 23 2016, 08:06:12) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import urllib3
>>> http = urllib3.PoolManager()
>>> r = http.request('GET', 'http://httpbin.org/robots.txt')

Traceback (most recent call last):
  File "C:\Users\a_v\Desktop\testvenv\t\lib\site-packages\urllib3\connection.py", line 159, in _new_conn
    (self._dns_host, self.port), self.timeout, **extra_kw)
  File "C:\Users\a_v\Desktop\testvenv\t\lib\site-packages\urllib3\util\connection.py", line 80, in create_connection
    raise err
  File "C:\Users\a_v\Desktop\testvenv\t\lib\site-packages\urllib3\util\connection.py", line 70, in create_connection
    sock.connect(sa)
TimeoutError: [WinError 10060] A connection attempt failed because the connected party did not properly respond after a period of time, or established
 connection failed because connected host has failed to respond

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\a_v\Desktop\testvenv\t\lib\site-packages\urllib3\connectionpool.py", line 600, in urlopen
    chunked=chunked)
  File "C:\Users\a_v\Desktop\testvenv\t\lib\site-packages\urllib3\connectionpool.py", line 354, in _make_request
    conn.request(method, url, **httplib_request_kw)
  File "C:\users\a_v\desktop\python36\Lib\http\client.py", line 1239, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "C:\users\a_v\desktop\python36\Lib\http\client.py", line 1285, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "C:\users\a_v\desktop\python36\Lib\http\client.py", line 1234, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "C:\users\a_v\desktop\python36\Lib\http\client.py", line 1026, in _send_output
    self.send(msg)
  File "C:\users\a_v\desktop\python36\Lib\http\client.py", line 964, in send
    self.connect()
  File "C:\Users\a_v\Desktop\testvenv\t\lib\site-packages\urllib3\connection.py", line 181, in connect
    conn = self._new_conn()
  File "C:\Users\a_v\Desktop\testvenv\t\lib\site-packages\urllib3\connection.py", line 168, in _new_conn
    self, "Failed to establish a new connection: %s" % e)
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0x0000000003218160>: Failed to establish a new connection: [WinErr
or 10060] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed be
cause connected host has failed to respond

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\a_v\Desktop\testvenv\t\lib\site-packages\urllib3\request.py", line 68, in request
    **urlopen_kw)
  File "C:\Users\a_v\Desktop\testvenv\t\lib\site-packages\urllib3\request.py", line 89, in request_encode_url
    return self.urlopen(method, url, **extra_kw)
  File "C:\Users\a_v\Desktop\testvenv\t\lib\site-packages\urllib3\poolmanager.py", line 323, in urlopen
    response = conn.urlopen(method, u.request_uri, **kw)
  File "C:\Users\a_v\Desktop\testvenv\t\lib\site-packages\urllib3\connectionpool.py", line 667, in urlopen
    **response_kw)
  File "C:\Users\a_v\Desktop\testvenv\t\lib\site-packages\urllib3\connectionpool.py", line 667, in urlopen
    **response_kw)
  File "C:\Users\a_v\Desktop\testvenv\t\lib\site-packages\urllib3\connectionpool.py", line 667, in urlopen
    **response_kw)
  File "C:\Users\a_v\Desktop\testvenv\t\lib\site-packages\urllib3\connectionpool.py", line 638, in urlopen
    _stacktrace=sys.exc_info()[2])
  File "C:\Users\a_v\Desktop\testvenv\t\lib\site-packages\urllib3\util\retry.py", line 398, in increment
    raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='httpbin.org', port=80): Max retries exceeded with url: /robots.txt (Caused by NewConnection
Error('<urllib3.connection.HTTPConnection object at 0x0000000003218160>: Failed to establish a new connection: [WinError 10060] A connection attempt f
ailed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed
to respond',))

Кто-нибудь сталкивался с чем-либо подобным?

Спасибо

...