1 개요[ | ]
- Python requests, Requests
- 파이썬 리퀘스츠, 리퀘스트
- 파이썬 HTTP 라이브러리
- 슬로건: "HTTP for Humans"
- "간결한, 또 하나의 우아한 HTTP 라이브러리"
- 간단하고 편리하다.
- 주요기능: 헤더 정보, JSON 파싱, Basic Auth
2 예제[ | ]
Python
Copy
import requests
r = requests.get('https://api.github.com/user', auth=('user', 'pass'))
print( r.status_code ) # 200
print( r.headers['content-type'] ) # 'application/json; charset=utf8'
print( r.encoding ) # 'utf-8'
print( r.text ) # u'{"type":"User"...'
print( r.json() ) #{u'private_gists': 419, u'total_private_repos': 77, ...}
3 같이 보기[ | ]
4 참고[ | ]
편집자 0draw Jmnote Jmnote bot
로그인하시면 댓글을 쓸 수 있습니다.