Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # coding: shift-jis
- import codecs
- import sys
- import urllib
- import urllib2
- import re, pprint
- errorCheck = "0"
- isbn = raw_input("Enter IBSN Number Please ")
- isIsbn = len(isbn)
- if isIsbn == 10 or isIsbn == 13:
- errorCheck = 1;
- print "isbn"
- url = "http://iss.ndl.go.jp/api/opensearch?isbn=%s" % isbn
- req = urllib2.Request(url)
- response = urllib2.urlopen(req)
- result = response.read()
- print(result)
- def pp(result):
- if isinstance(result, list) or isinstance(result, dict):
- orig = json.dumps(result, indent=4)
- print eval("u'''%s'''" % orig).encode('shift-jis')
- else:
- print result
- if errorCheck == "0":
- print "It is not ISBN"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement