• 카테고리

    질문 & 답변
  • 세부 분야

    데이터 분석

  • 해결 여부

    미해결

Exception has occurred: SSLError 이런 에러가 발생합니다.

23.02.19 10:01 작성 23.02.27 07:58 수정 조회수 1.36k

0

이 강의에서 에러가 발생했습니다.

소스코드는 다음과 같습니다.

import requests
from bs4 import BeautifulSoup

url = "https://www.naver.com/"
response = requests.get(url)  # 에러 발생한 부분
html = response.text
soup = BeautifulSoup(html, 'html.parser')
word = soup.select_one("#NM_set_home_btn")
print(word.text)

위 코드중

response = requests.get(url)

위 부분에서 에러가 발생했습니다.

 

[ 에러 내용 ]

Max retries exceeded with url:강의에서 접속한 url

이런 에러가 나오고

Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available.

뒤에 이런 문장이 나옵니다.

 

에러 해결 방법은 무었인가요?

 

[ 에러 전체 내용 ]

에러의 전체 내용은 다음과 같습니다.

Exception has occurred: SSLError
HTTPSConnectionPool(host='search.naver.com', port=443): Max retries exceeded with url: /search.naver?where=news&sm=tab_jum&query=%EC%82%BC%EC%84%B1%EC%A0%84%EC%9E%90 (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available."))
urllib3.exceptions.SSLError: Can't connect to HTTPS URL because the SSL module is not available.

During handling of the above exception, another exception occurred:

urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='search.naver.com', port=443): Max retries exceeded with url: /search.naver?where=news&sm=tab_jum&query=%EC%82%BC%EC%84%B1%EC%A0%84%EC%9E%90 (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available."))

During handling of the above exception, another exception occurred:

  File "D:\crawling\05. 뉴스 제목과 링크 가져오기.py", line 4, in <module>
    response = requests.get("https://search.naver.com/search.naver?where=news&sm=tab_jum&query=%EC%82%BC%EC%84%B1%EC%A0%84%EC%9E%90")
requests.exceptions.SSLError: HTTPSConnectionPool(host='search.naver.com', port=443): Max retries exceeded with url: /search.naver?where=news&sm=tab_jum&query=%EC%82%BC%EC%84%B1%EC%A0%84%EC%9E%90 (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available."))


답변 1

답변을 작성해보세요.

0

새벽별님의 프로필

새벽별

질문자

2023.02.19

이 에러때문에 반나절동안 검색한 것 같습니다.

원인은 아나콘다 이슈가 아닌가 생각됩니다.

검색해보니 저와 같은 에러로 5일전에 이슈를 제기했네요.

그래서 아나콘다 가상환경이 아닌...

파이썬 자체적으로 제공하는 가상환경을 만들고 코드를 실행하니 에러가 발생하지 않았습니다. 참고 바랍니다.