Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ConnectionError 10054 #104

Open
Tedsoul opened this issue Dec 5, 2018 · 1 comment
Open

ConnectionError 10054 #104

Tedsoul opened this issue Dec 5, 2018 · 1 comment

Comments

@Tedsoul
Copy link

Tedsoul commented Dec 5, 2018

E:\System-User\DeskTop\tumblr-crawler-master\1>tumblr-photo-ripper.py
Traceback (most recent call last):
File "C:\Python\Python36\lib\site-packages\urllib3\connectionpool.py", line 600, in urlopen
chunked=chunked)
File "C:\Python\Python36\lib\site-packages\urllib3\connectionpool.py", line 384, in _make_request
six.raise_from(e, None)
File "", line 2, in raise_from
File "C:\Python\Python36\lib\site-packages\urllib3\connectionpool.py", line 380, in _make_request
httplib_response = conn.getresponse()
File "C:\Python\Python36\lib\http\client.py", line 1331, in getresponse
response.begin()
File "C:\Python\Python36\lib\http\client.py", line 297, in begin
version, status, reason = self._read_status()
File "C:\Python\Python36\lib\http\client.py", line 258, in _read_status
line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
File "C:\Python\Python36\lib\socket.py", line 586, in readinto
return self._sock.recv_into(b)
File "C:\Python\Python36\lib\ssl.py", line 1009, in recv_into
return self.read(nbytes, buffer)
File "C:\Python\Python36\lib\ssl.py", line 871, in read
return self._sslobj.read(len, buffer)
File "C:\Python\Python36\lib\ssl.py", line 631, in read
v = self._sslobj.read(len, buffer)
ConnectionResetError: [WinError 10054] 远程主机强迫关闭了一个现有的连接。

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\Python\Python36\lib\site-packages\requests\adapters.py", line 449, in send
timeout=timeout
File "C:\Python\Python36\lib\site-packages\urllib3\connectionpool.py", line 638, in urlopen
_stacktrace=sys.exc_info()[2])
File "C:\Python\Python36\lib\site-packages\urllib3\util\retry.py", line 367, in increment
raise six.reraise(type(error), error, _stacktrace)
File "C:\Python\Python36\lib\site-packages\urllib3\packages\six.py", line 685, in reraise
raise value.with_traceback(tb)
File "C:\Python\Python36\lib\site-packages\urllib3\connectionpool.py", line 600, in urlopen
chunked=chunked)
File "C:\Python\Python36\lib\site-packages\urllib3\connectionpool.py", line 384, in _make_request
six.raise_from(e, None)
File "", line 2, in raise_from
File "C:\Python\Python36\lib\site-packages\urllib3\connectionpool.py", line 380, in _make_request
httplib_response = conn.getresponse()
File "C:\Python\Python36\lib\http\client.py", line 1331, in getresponse
response.begin()
File "C:\Python\Python36\lib\http\client.py", line 297, in begin
version, status, reason = self._read_status()
File "C:\Python\Python36\lib\http\client.py", line 258, in _read_status
line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
File "C:\Python\Python36\lib\socket.py", line 586, in readinto
return self._sock.recv_into(b)
File "C:\Python\Python36\lib\ssl.py", line 1009, in recv_into
return self.read(nbytes, buffer)
File "C:\Python\Python36\lib\ssl.py", line 871, in read
return self._sslobj.read(len, buffer)
File "C:\Python\Python36\lib\ssl.py", line 631, in read
v = self._sslobj.read(len, buffer)
urllib3.exceptions.ProtocolError: ('Connection aborted.', ConnectionResetError(10054, '远程主机强迫关闭了一个现有的连接 。', None, 10054, None))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "E:\System-User\DeskTop\tumblr-crawler-master\1\tumblr-photo-ripper.py", line 306, in
CrawlerScheduler(sites, proxies=proxies)
File "E:\System-User\DeskTop\tumblr-crawler-master\1\tumblr-photo-ripper.py", line 157, in init
self.scheduling()
File "E:\System-User\DeskTop\tumblr-crawler-master\1\tumblr-photo-ripper.py", line 170, in scheduling
self.download_media(site)
File "E:\System-User\DeskTop\tumblr-crawler-master\1\tumblr-photo-ripper.py", line 173, in download_media
self.download_photos(site)
File "E:\System-User\DeskTop\tumblr-crawler-master\1\tumblr-photo-ripper.py", line 184, in download_photos
self._download_media(site, "photo", START)
File "E:\System-User\DeskTop\tumblr-crawler-master\1\tumblr-photo-ripper.py", line 201, in _download_media
proxies=self.proxies)
File "C:\Python\Python36\lib\site-packages\requests\api.py", line 75, in get
return request('get', url, params=params, **kwargs)
File "C:\Python\Python36\lib\site-packages\requests\api.py", line 60, in request
return session.request(method=method, url=url, **kwargs)
File "C:\Python\Python36\lib\site-packages\requests\sessions.py", line 533, in request
resp = self.send(prep, **send_kwargs)
File "C:\Python\Python36\lib\site-packages\requests\sessions.py", line 646, in send
r = adapter.send(request, **kwargs)
File "C:\Python\Python36\lib\site-packages\requests\adapters.py", line 498, in send
raise ConnectionError(err, request=request)
requests.exceptions.ConnectionError: ('Connection aborted.', ConnectionResetError(10054, '远程主机强迫关闭了一个现有的连接。', None, 10054, None))

这个情况发生在我想爬含大量的图片的blog的时候(大概超过10,000张)
郁闷,我已经设置了sleep了

@Tedsoul Tedsoul changed the title SSLError ConnectionError 10054 Dec 5, 2018
@Tedsoul
Copy link
Author

Tedsoul commented Dec 5, 2018

Traceback (most recent call last):
File "C:\Python\Python36\lib\site-packages\urllib3\connectionpool.py", line 600, in urlopen
chunked=chunked)
File "C:\Python\Python36\lib\site-packages\urllib3\connectionpool.py", line 343, in _make_request
self._validate_conn(conn)
File "C:\Python\Python36\lib\site-packages\urllib3\connectionpool.py", line 839, in validate_conn
conn.connect()
File "C:\Python\Python36\lib\site-packages\urllib3\connection.py", line 344, in connect
ssl_context=context)
File "C:\Python\Python36\lib\site-packages\urllib3\util\ssl
.py", line 344, in ssl_wrap_socket
return context.wrap_socket(sock, server_hostname=server_hostname)
File "C:\Python\Python36\lib\ssl.py", line 407, in wrap_socket
_context=self, _session=session)
File "C:\Python\Python36\lib\ssl.py", line 814, in init
self.do_handshake()
File "C:\Python\Python36\lib\ssl.py", line 1068, in do_handshake
self._sslobj.do_handshake()
File "C:\Python\Python36\lib\ssl.py", line 689, in do_handshake
self._sslobj.do_handshake()
ssl.SSLEOFError: EOF occurred in violation of protocol (_ssl.c:841)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\Python\Python36\lib\site-packages\requests\adapters.py", line 449, in send
timeout=timeout
File "C:\Python\Python36\lib\site-packages\urllib3\connectionpool.py", line 638, in urlopen
_stacktrace=sys.exc_info()[2])
File "C:\Python\Python36\lib\site-packages\urllib3\util\retry.py", line 398, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='xxx.tumblr.com', port=443): Max retries exceeded with url: /api/read?type=photo&num=50&start=4400 (Caused by SSLError(SSLEOFError(8, 'EOF occurred in violation of protocol (_ssl.c:841)'),))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "E:\System-User\DeskTop\tumblr-crawler-master\1\tumblr-photo-ripper.py", line 306, in
CrawlerScheduler(sites, proxies=proxies)
File "E:\System-User\DeskTop\tumblr-crawler-master\1\tumblr-photo-ripper.py", line 157, in init
self.scheduling()
File "E:\System-User\DeskTop\tumblr-crawler-master\1\tumblr-photo-ripper.py", line 170, in scheduling
self.download_media(site)
File "E:\System-User\DeskTop\tumblr-crawler-master\1\tumblr-photo-ripper.py", line 173, in download_media
self.download_photos(site)
File "E:\System-User\DeskTop\tumblr-crawler-master\1\tumblr-photo-ripper.py", line 184, in download_photos
self._download_media(site, "photo", START)
File "E:\System-User\DeskTop\tumblr-crawler-master\1\tumblr-photo-ripper.py", line 201, in _download_media
proxies=self.proxies)
File "C:\Python\Python36\lib\site-packages\requests\api.py", line 75, in get
return request('get', url, params=params, **kwargs)
File "C:\Python\Python36\lib\site-packages\requests\api.py", line 60, in request
return session.request(method=method, url=url, **kwargs)
File "C:\Python\Python36\lib\site-packages\requests\sessions.py", line 533, in request
resp = self.send(prep, **send_kwargs)
File "C:\Python\Python36\lib\site-packages\requests\sessions.py", line 646, in send
r = adapter.send(request, **kwargs)
File "C:\Python\Python36\lib\site-packages\requests\adapters.py", line 514, in send
raise SSLError(e, request=request)
requests.exceptions.SSLError: HTTPSConnectionPool(host='xxx.tumblr.com', port=443): Max retries exceeded with url: /api/read?type=photo&num=50&start=4400 (Caused by SSLError(SSLEOFError(8, 'EOF occurred in violation of protocol (_ssl.c:841)'),))

这两种情况交替的在发生

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant