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
...For the end user several scripts are provided to use from the command line:
$ to_isbn10 ISBN13transforms an ISBN13 number to ISBN10.
$ to_isbn13 ISBN10transforms an ISBN10 number to ISBN13.
$ isbn_info ISBNgives you the group identifier of the ISBN.
$ isbn_mask ISBNmasks (hyphenate) an ISBN (split it by identifiers).
$ isbn_meta ISBN [wcat|goob|openl|isbndb|merge] [bibtex|...] [YOUR_APIKEY_TO_SERVICE]gives you the main metadata associated with the ISBN, wcat uses worldcat.org
(no key is needed), goob uses the Google Books service (no key is needed),
isbndb uses the isbndb.com service (an api key is needed),
openl uses the OpenLibrary.org api (no key is needed), merge uses
a mergeded record of wcat and goob records (no key is needed) and
is the default option (you only have to enter, e.g. isbn_meta 9780321534965).
You can get an API key for the isbndb.com service here.
You can enter API keys and set preferences in the file isbntools.conf in your
$HOME\.isbntools directory (UNIX). For Windows, you should look at
%APPDATA%/isbntools/isbntools.conf.
The output can be formatted as bibtex, msword, endnote, refworks, or
json (BibJSON) bibliographic formats.
$ isbn_editions ISBNgives the collection of ISBNs that represent a given book (uses worldcat.org).
$ isbn_validate ISBNvalidates ISBN10 and ISBN13.
$ ... | isbn_stdin_validateto use with pipes (e.g. cat FILE_WITH_ISBNs | isbn_stdin_validate).
$ isbn_from_words "words from title and author name"a fuzzy script that returns the most probable ISBN from a set of words.
(You can verify the result with isbn_meta)!
$ isbn_goom "words from title and author name" [bibtex|msword|endnote|refworks|json]a script that returns from Google Books multiple references.
$ isbntoolswrites version and copyright notice and checks if there are updates.
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
from isbntools import *
query = sys.argv[1].replace(' ', '+')
isbn = isbn_from_words(query)
print("The ISBN of the most `spoken-about` book with this title is %s" % isbn)
print("")
print("... and the book is:")
print("")
print((meta(isbn)))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': u'9780143105985', 'Authors': u'Don DeLillo ;
introduction by Richard Powers.'}
Have fun!
From the command line enter (in some cases you have to preced the
command with sudo):
$ pip install isbntoolsthis installs from pypi or:
$ easy_install isbntoolsthis installs from pypi too, or (to install locally in Linux or Mac OS X):
$ pip install isbntools-3.2.2.tar.gzbut first you have to download the file!
You should check if the install was successful, by enter:
$ isbntoolsIf you are on a Windows system, you can download a standalone version that doesn't need python and gives you access to the scripts. However, doesn't support add-ins or customization!
Intructions:
- unzip the file and put the file
isbn.exein a folder - go to that folder and open a command line
- run
isbn helpto get further instructions
Please read at least this page of the documentation.
You can browse the code, in a very structured way, at sourcegraph.
If you would like to contribute to the project, please read the guidelines.
You can enter API keys and set preferences in the file isbntools.conf in your
$HOME\.isbntools directory (UNIX). For Windows, you should look at
%APPDATA%/isbntools/isbntools.conf
(create these, directory and file, if don't exist). The file should look like:
[SYS]
SOCKETS_TIMEOUT=15
THREADS_TIMEOUT=12
[SERVICES]
DEFAULT_SERVICE=merge
VIAS_MERGE=serial
ISBNDB_API_KEY=your_api_key_here_or_DELETEME
[PLUGINS]
isbndb=isbndb.py
openl=openl.pyThe values are self-explanatory!
NOTE If you are running
isbntoolsinside a virtual environment, theisbntools.conffile will be at the root of the environment.
-
The
metamethod and theisbn_metascript sometimes give a wrong result (this is due to errors on the chosen service), in alternative you could try one of the others services. -
The
isbntoolsworks internally with unicode, however this doesn't solve errors of lost information due to bad encode/decode at the origin! -
Periodically, agencies, issue new blocks of ISBNs. The range of these blocks is on a database that
maskuses. So it could happen, if you have a version ofisbntoolsthat is too old,maskdoesn't work for valid (recent) issued ISBNs. The solution? Updateisbntoolsoften!
Any issue that you would like to report, please do it at github (if you are a developer) or at twitter (if you are an end user).
More documentation at isbntools.readthedocs.org






