API Request: http://iss.ndl.go.jp/api/opensearch?isbn=9784334770051
I need to get one specific value from the XML that provided through API from the above.
I try to get the all value from the <item>
and also the <dc:title>
's value specifically
Following are my current code that I were attempt to get all value from items but didn't work.
import codecs
import sys
import urllib
import urllib2
import re, pprint
from xml.etree.ElementTree import *
import csv
from xml.dom import minidom
import xml.etree.ElementTree as ET
errorCheck = "0"
isbn = raw_input("Enter IBSN Number Please ")
isIsbn = len(isbn)
if isIsbn == 10 or isIsbn == 13:
errorCheck = 1;
url = "http://iss.ndl.go.jp/api/opensearch?isbn=%s" % isbn
req = urllib2.Request(url)
response = urllib2.urlopen(req)
XmlData = response.read()
root = ET.fromstring(XmlData)
print(root.tag,root.attrib)
for child in root.find('item'):
print child.tag
print child.attrib
print child.text
if errorCheck == "0":
print "It is not ISBN"