Last active
August 29, 2015 14:24
-
-
Save m-note/e45511c00897f630e423 to your computer and use it in GitHub Desktop.
DietRecod
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
import httplib2 | |
def DietSearch(search): | |
request = "http://kokkai.ndl.go.jp/api/1.0/speech?" + urllib.parse.quote_plus(search,encoding="utf-8") | |
h = httplib2.Http('.cache') #by httplib2 | |
response, content = h.request(request) | |
#content = content.decode("utf-8") #etree.fromstringをするときに、"Unicode strings with encoding declaration are not supported. Please use bytes input or XML fragments without declaration."というエラーを回避するためにこの行は使わない | |
return content |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment