Programming/Python

Requests module 사용하기

uthline 2018. 2. 25. 21:31
반응형

Requests

Requests allows you to send organic, grass-fed HTTP/1.1 requests, without the need for manual labor. There's no need to manually add query strings to your URLs, or to form-encode your POST data. Keep-alive and HTTP connection pooling are 100% automatic, thanks to urllib3.

설치 방법

python 설치 폴더의 site-packages폴더로 이용하여 아래의 명령을 입력하면 된다.
python easy_install.py requests

정상적으로 설치가 되면 아래의 화면이 출력된다.


Simple usage

Postman(HTTP Request composer)에서 언급되었던 http://httpbin.org사이트를 이용해서 한번 request의 응답을 받아보자.


실행하면 아래와 같이 응답이 오는 것을 확인 할 수 있습니다.

Source code

clone the public repository

Or, download thr tarball


참고 링크

http://docs.python-requests.org/en/master/


반응형