Last active
August 29, 2015 14:25
-
-
Save lseongjoo/e36d1d12b1d2aec1e1db to your computer and use it in GitHub Desktop.
웹 API 요청 질문 관련 (2015-07-19)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# coding: utf-8 | |
""" | |
https://www.facebook.com/bigpython | |
""" | |
import requests | |
response = requests.get('http://api.openhangul.com/dic', {'api_key':20141107174448, 'q':u'좋다'}) | |
# content-length | |
cLen = response.headers['Content-Length'] | |
# Get the content of the HTTP response | |
content = response.content.decode('utf-8').strip() | |
print(cLen) | |
print(content) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
HTTP 요청 시, requests 패키지를 추천합니다.
http://docs.python-requests.org/en/latest/user/quickstart/