Skip to content

Instantly share code, notes, and snippets.

@m-note
Last active August 29, 2015 14:24
Show Gist options
  • Save m-note/e45511c00897f630e423 to your computer and use it in GitHub Desktop.
Save m-note/e45511c00897f630e423 to your computer and use it in GitHub Desktop.
DietRecod
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