Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (pypi.python.org).
Help us improve Python packaging - Donate today!

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

Project Description

Info

isbntools provides several useful methods and functions to validate, clean, transform, hyphenate and get metadata for 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 worldcat.org).

$ isbn_validate ISBN

validates ISBN10 and ISBN13.

$ ... | isbn_stdin_validate

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

$ isbn_stdin_validate "words from title and author name"

a fuzzy script that returns the most probable ISBN from a set of words! You could verify the result with isbn_meta.

$ 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 urllib2
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'}
request = urllib2.Request(SEARCH_URL, headers=headers)
response = urllib2.urlopen(request)
content = response.read()

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 the command line enter:

$ pip install isbntools

or:

$ easy_install isbntools

or:

$ pip install isbntools-1.0.0.tar.gz

(first you have to download the file and in some cases you have to preced the command by sudo!)

Known Issues

  1. The meta method and the isbn_meta script sometimes give a wrong result (this is due to errors on the worldcat.org service), in alternative you could use the Google Books service (e.g. isbn_meta 9781107008267 goob)
Release History

Release History

History Node

4.3.7

History Node

4.3.6

History Node

4.3.5

History Node

4.3.4

History Node

4.3.3

History Node

4.3.2

History Node

4.3.1

History Node

4.2.7

History Node

4.2.6

History Node

4.2.5

History Node

4.2.4

History Node

4.2.3

History Node

4.2.2

History Node

4.2.1

History Node

4.1.3

History Node

4.1.2

History Node

4.1.1

History Node

4.0.2

History Node

4.0.1

History Node

3.3.9

History Node

3.3.8

History Node

3.3.7

History Node

3.3.6

History Node

3.3.5

History Node

3.3.4

History Node

3.3.3

History Node

3.3.2

History Node

3.3.1

History Node

3.2.4

History Node

3.2.3

History Node

3.2.2

History Node

3.2.2a

History Node

3.2.1

History Node

3.1.4

History Node

3.1.3

History Node

3.1.2

History Node

3.1.1

History Node

3.1.0

History Node

3.0.3

History Node

3.0.2

History Node

3.0.1

History Node

3.0.0

History Node

2.3.7

History Node

2.3.6

History Node

2.3.5

History Node

2.3.4

History Node

2.3.3

History Node

2.3.2

History Node

2.3.1

History Node

2.2.2

History Node

2.2.1

History Node

2.1.2

History Node

2.1.1

History Node

2.0.8

History Node

2.0.7

History Node

2.0.6

History Node

2.0.5

History Node

2.0.4

History Node

2.0.3

History Node

2.0.2

History Node

2.0.1

History Node

1.0.3

History Node

1.0.2

History Node

1.0.1

This version
History Node

1.0.0

History Node

0.8.4

History Node

0.8.3

History Node

0.8.2

History Node

0.8.1

History Node

0.7.5

History Node

0.7.4

History Node

0.7.3

History Node

0.7.2

Download Files

Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
isbntools-1.0.0.tar.gz (17.4 kB) Copy SHA256 Checksum SHA256 Source Mar 5, 2014

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting