前提・実現したいこと
webスクレイピングの際以下のエラー文が出ます
SSL承認が降りない?
どう対処すればいいですか?
発生している問題・エラーメッセージ
--------------------------------------------------------------------------- ConnectionResetError Traceback (most recent call last) ~/opt/anaconda3/lib/python3.8/urllib/request.py in do_open(self, http_class, req, **http_conn_args) 1349 try: -> 1350 h.request(req.get_method(), req.selector, req.data, headers, 1351 encode_chunked=req.has_header('Transfer-encoding')) ~/opt/anaconda3/lib/python3.8/http/client.py in request(self, method, url, body, headers, encode_chunked) 1254 """Send a complete request to the server.""" -> 1255 self._send_request(method, url, body, headers, encode_chunked) 1256 ~/opt/anaconda3/lib/python3.8/http/client.py in _send_request(self, method, url, body, headers, encode_chunked) 1300 body = _encode(body, 'body') -> 1301 self.endheaders(body, encode_chunked=encode_chunked) 1302 ~/opt/anaconda3/lib/python3.8/http/client.py in endheaders(self, message_body, encode_chunked) 1249 raise CannotSendHeader() -> 1250 self._send_output(message_body, encode_chunked=encode_chunked) 1251 ~/opt/anaconda3/lib/python3.8/http/client.py in _send_output(self, message_body, encode_chunked) 1009 del self._buffer[:] -> 1010 self.send(msg) 1011 ~/opt/anaconda3/lib/python3.8/http/client.py in send(self, data) 949 if self.auto_open: --> 950 self.connect() 951 else: ~/opt/anaconda3/lib/python3.8/http/client.py in connect(self) 1423 -> 1424 self.sock = self._context.wrap_socket(self.sock, 1425 server_hostname=server_hostname) ~/opt/anaconda3/lib/python3.8/ssl.py in wrap_socket(self, sock, server_side, do_handshake_on_connect, suppress_ragged_eofs, server_hostname, session) 499 # ctx._wrap_socket() --> 500 return self.sslsocket_class._create( 501 sock=sock, ~/opt/anaconda3/lib/python3.8/ssl.py in _create(cls, sock, server_side, do_handshake_on_connect, suppress_ragged_eofs, server_hostname, context, session) 1039 raise ValueError("do_handshake_on_connect should not be specified for non-blocking sockets") -> 1040 self.do_handshake() 1041 except (OSError, ValueError): ~/opt/anaconda3/lib/python3.8/ssl.py in do_handshake(self, block) 1308 self.settimeout(None) -> 1309 self._sslobj.do_handshake() 1310 finally: ConnectionResetError: [Errno 54] Connection reset by peer During handling of the above exception, another exception occurred: URLError Traceback (most recent call last) <ipython-input-13-7d37b3345523> in <module> 1 url = "https://share-videos.se/view/new?uid=114150" ----> 2 respomse = req.urlopen(url) ~/opt/anaconda3/lib/python3.8/urllib/request.py in urlopen(url, data, timeout, cafile, capath, cadefault, context) 220 else: 221 opener = _opener --> 222 return opener.open(url, data, timeout) 223 224 def install_opener(opener): ~/opt/anaconda3/lib/python3.8/urllib/request.py in open(self, fullurl, data, timeout) 523 524 sys.audit('urllib.Request', req.full_url, req.data, req.headers, req.get_method()) --> 525 response = self._open(req, data) 526 527 # post-process response ~/opt/anaconda3/lib/python3.8/urllib/request.py in _open(self, req, data) 540 541 protocol = req.type --> 542 result = self._call_chain(self.handle_open, protocol, protocol + 543 '_open', req) 544 if result: ~/opt/anaconda3/lib/python3.8/urllib/request.py in _call_chain(self, chain, kind, meth_name, *args) 500 for handler in handlers: 501 func = getattr(handler, meth_name) --> 502 result = func(*args) 503 if result is not None: 504 return result ~/opt/anaconda3/lib/python3.8/urllib/request.py in https_open(self, req) 1391 1392 def https_open(self, req): -> 1393 return self.do_open(http.client.HTTPSConnection, req, 1394 context=self._context, check_hostname=self._check_hostname) 1395 ~/opt/anaconda3/lib/python3.8/urllib/request.py in do_open(self, http_class, req, **http_conn_args) 1351 encode_chunked=req.has_header('Transfer-encoding')) 1352 except OSError as err: # timeout error -> 1353 raise URLError(err) 1354 r = h.getresponse() 1355 except: URLError: <urlopen error [Errno 54] Connection reset by peer>
補足情報(FW/ツールのバージョンなど)
os bigsur
python3.8
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。