requests 는 사용하기 쉬운 파이썬용 HTTP 라이브러리입니다.

설치

Requests 는 python 2.7 과 3.6 이상을 지원하며 pip 를 사용해서 설치하면 됩니다.

python -m pip install --user requests
CODE


사용

간단한 사용법

import requests

# r 은 Response 객체
r = requests.get('https://github.com/lesstif')

print(r.status_code)
print(r.headers)
print(r.encoding)
print(r.text)
print(r.json())
PY

Post

import requests

r = requests.post('https://httpbin.org/post', data={'name': 'lesstif', 'key': 'value'})

print(r.status_code)
print(r.text)
PY



같이 보기

Ref