Skip to content

Instantly share code, notes, and snippets.

@lseongjoo
Last active August 29, 2015 14:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lseongjoo/e36d1d12b1d2aec1e1db to your computer and use it in GitHub Desktop.
Save lseongjoo/e36d1d12b1d2aec1e1db to your computer and use it in GitHub Desktop.
웹 API 요청 질문 관련 (2015-07-19)
# 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)
@lseongjoo
Copy link
Author

HTTP 요청 시, requests 패키지를 추천합니다.
http://docs.python-requests.org/en/latest/user/quickstart/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment