Skip to content

Instantly share code, notes, and snippets.

@m-note
Created July 14, 2015 07:15
Show Gist options
  • Save m-note/928eb89dc1a6f8db515c to your computer and use it in GitHub Desktop.
Save m-note/928eb89dc1a6f8db515c to your computer and use it in GitHub Desktop.
Get From Diet Record
import urllib.request
import urllib.parse #参考: http://d.hatena.ne.jp/motie/20100728/1280335730
search = "startRecord=1&maximumRecords=5&any=アベノミクス&speaker=安倍晋三"
def DietSearch(search):
request = "http://kokkai.ndl.go.jp/api/1.0/speech?" + urllib.parse.quote_plus(search,encoding="utf-8")
returnXML = ""
with urllib.request.urlopen(request) as page:
for line in page.readlines():
returnXML = returnXML + line.decode("utf-8")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment