Created
July 14, 2015 07:15
-
-
Save m-note/928eb89dc1a6f8db515c to your computer and use it in GitHub Desktop.
Get From Diet Record
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 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