skip to navigation
skip to content

Not Logged In

isbntools 0.7.5

Extract, clean, validate, transform and metadata for ISBNs (International Standard Book Number).

Latest Version: 4.2.5

Info

isbntools provides several useful methods and functions to validate, clean and transform ISBN strings.

Typical usage (as library):

#!/usr/bin/env python
import isbntools
...

Several scripts are provided to use from the command line:

$ to_isbn10 ISBN13

transforms an ISBN10 number to ISBN13.

$ to_isbn13 ISBN10

transforms an ISBN13 number to ISBN10.

$ isbn_info ISBN

gives you the group identifier of the ISBN.

$ isbn_mask ISBN

masks (hyphenate) an ISBN (split it by identifiers).

$ isbn_meta ISBN

gives you the main metadata associated with the ISBN (uses wcat.org).

$ isbn_validate ISBN

validates ISBN10 and ISBN13.

$ isbn_stdin_validate

to use with posix pipes (e.g. cat ISBNs | isbn_stdin_validate).

$ isbntools

writes version and copyright notice.

Many more scripts could be written with the isbntools library, using the methods for extraction, cleaning, validation and standardization of ISBNs.

Just for fun, suppose I want the most spoken about book with certain words in his title. For a quick-and-dirty solution, enter the following code in a file and save it as isbn_tmsa_book.py.

#!/usr/bin/env python
import sys
import httplib2
from isbntools import *

query = sys.argv[1].replace(' ', '+')
SEARCH_URL = "http://www.google.com/search?q=%s+ISBN" % query

headers = {'User-Agent': 'w3m/0.5.2'}
http = httplib2.Http()
resp, content = http.request(SEARCH_URL, headers=headers)

isbns = get_isbnlike(content)

for item in isbns:
    ib = get_canonical_isbn(item, output='ISBN-13')
    if ib: break

print("The ISBN of the most `spoken-about` book with this title is %s" % ib)
print("")
print("... and the book is:")
print("")
print((meta(ib)))

Then in a command line (in the same directory):

$ python isbn_tmsa_book.py 'noise'

In my case I get:

The ISBN of the most `spoken-about` book with this title is 9780143105985

... and the book is:

{'Publisher': u'Penguin Books', 'Language': u'eng', 'Title': u'White noise',
'Year': u'2009', 'ISBN-13': '9780143105985', 'Authors': u'Don DeLillo ;
introduction by Richard Powers.'}

Have fun!

Install

From a command line enter:

$ pip install isbntools

or:

$ easy_install isbntools

or:

$ pip install isbntools-0.7.5.tar.gz

(first you have to download the file!)

Known Issues

  1. The meta method and the isbn_meta script sometimes give a wrong result (this is due to errors on the wcat.org service)
 
File Type Py Version Uploaded on Size
isbntools-0.7.5.tar.gz (md5) Source 2014-03-01 15KB
  • Downloads (All Versions):
  • 65 downloads in the last day
  • 744 downloads in the last week
  • 4912 downloads in the last month