커뮤니티
포인트
쿠폰
내 강의실
국비 신청 내역
증명서
계정
로그아웃
학습 질문
개발 일지
나의 활동
답변 완료
스크래핑이 안되는 웹페이지가 있나요?
undefined주차
북마크
이*열
댓글
1
추천
0
조회수
7
조회수
7
답변 완료

* 겪고 있는 문제 상황을 최대한 자세하게 작성해주세요.

* 문제 해결을 위해 어떤 시도를 해보았는지 구체적으로 함께 알려주세요.



네이버 검색이 아니라 다른 페이지에서 스크래핑을 시도합니다.

기상청 홈페이지에서 스크래핑 하니 오류가 발생합니다.

SSLError: HTTPSConnectionPool(host='amo.kma.go.kr', port=443): Max retries exceeded with url: /weather/airport.do?icaoCode=RKSI (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1131)')))



스파르타 즉문즉답




import requests

from bs4 import BeautifulSoup


headers = {'User-Agent' : 'Mozilla/5.0 (Windows NT 10.0; Win64; x64)AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.86 Safari/537.36'}

data = requests.get('https://amo.kma.go.kr/weather/airport.do?icaoCode=RKSI',headers=headers)


soup = BeautifulSoup(data.text, 'html.parser')


soup



SSLCertVerificationError                  Traceback (most recent call last)
/usr/local/lib/python3.8/dist-packages/urllib3/connectionpool.py in urlopen(self, method, url, body, headers, retries, redirect, assert_same_host, timeout, pool_timeout, release_conn, chunked, body_pos, **response_kw)
    596             # Make the request on the httplib connection object.
--> 597             httplib_response = self._make_request(conn, method, url,
    598                                                   timeout=timeout_obj,


15 frames

SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1131)
During handling of the above exception, another exception occurred:

MaxRetryError                             Traceback (most recent call last)
MaxRetryError: HTTPSConnectionPool(host='amo.kma.go.kr', port=443): Max retries exceeded with url: /weather/airport.do?icaoCode=RKSI (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1131)')))
During handling of the above exception, another exception occurred:

SSLError                                  Traceback (most recent call last)
/usr/local/lib/python3.8/dist-packages/requests/adapters.py in send(self, request, stream, timeout, verify, cert, proxies)
    512             if isinstance(e.reason, _SSLError):
    513                 # This branch is for urllib3 v1.22 and later.
--> 514                 raise SSLError(e, request=request)
    515 
    516             raise ConnectionError(e, request=request)

SSLError: HTTPSConnectionPool(host='amo.kma.go.kr', port=443): Max retries exceeded with url: /weather/airport.do?icaoCode=RKSI (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1131)')))


취소
 공유
취소
댓글 0
댓글 알림
나의얼굴