python라이브러리로 url을 요청하고, 그 html에 대한 태그와 정보들을 받아오기 위한 필수 라이브러리이다. 매우 중요
pip install requests
로 설치 한다.
import requests로 사용하고
#토익 필수 단어
url = "https://wordbook.daum.net/open/wordbook.do?id=17"
#url로 해당 사이트 정보 받아오개
response = requests.get(url);
#요청 상태 확인
print(response.status_code) #200
#요청 데이터 확인
print(response.text)
print(response.text) 데이터
<!doctype html> <html lang="ko" xmlns:daum="http://dic.daum.net/"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>다음 단어장</title> <meta name="format-detection" content="telephone=no" /> <meta name="tiara:svcdomain" content="dic.daum.net" /> <meta name="tiara:section" content="wordbook" /><meta name="tiara:deployment" content="production" />
이제 가져온 데이터를 Beautiful Soup4
라는 라이브러리를 사용해서 이쁘게 만들어주고 데이터를 가져오도록 다음 포스팅에서 업로딩하도록 하겠습니다.