컴퓨터/파이썬
Requests
동네버핏
2020. 5. 10. 16:00
더보기
파이썬 패키지 설치
pip install requests
get 방식으로 웹페이지 요청
import requests
url = 'https://www.tistory.com'
response = requests.get(url)
print(response)
print(response.text[:300])
실행 결과
<Response [200]>
<!doctype html>
<html lang="ko">
<head>
<meta charset="utf-8">
<meta property="og:url" content="https://www.tistory.com">
<meta property="og:site_name" content="TISTORY">
<meta property="og:title" content="TISTORY">
<meta property="og:description" content="나를 표현하는 블로그를 만들어보세요.">
<met
<Response [200]>
<!doctype html>
<html lang="ko">
<head>
<meta charset="utf-8">
<meta property="og:url" content="https://www.tistory.com">
<meta property="og:site_name" content="TISTORY">
<meta property="og:title" content="TISTORY">
<meta property="og:description" content="나를 표현하는 블로그를 만들어보세요.">
<met