In this article, we are going to write python scripts for searching books using isbntools modules. isbntools module able to search for books by their name or ISBN( International Standard Book Number) and return all the information about the book.
Installation: Run the following pip command:
pip install isbntools
Importing the module:
Python3
from isbntools.app import * |
1. Use isbn_from_words() function to get the ISBN for a book.
Syntax: isbn_from_words(str)
Parameter: book name
Returns: ISBN of the book.
Python3
get_isbn = isbn_from_words( "Half Girlfriend" ) print (get_isbn) |
Output:
9788129135728
2. Get the information of a book by its ISBN.
Syntax: registry.bibformatters[identifiers](meta(isbn))
Parameter: ISB Number of the book
Returns: the meta information of the book
Notes: Identifiers can be used to print different types of format (bibtex, csl, opf, msword, endnote, refworks, json).
Python3
print (registry.bibformatters[ 'labels' ](meta( "9788129135728" ))) |
Output:
3. If you want to print the object without identifiers then you will all object in a specific location.
Python3
print (registry.bibformatters) |
Output:
4. Get information in JSON format:
Python3
print (registry.bibformatters[ 'json' ](meta( "9788129135728" ))) |
Output:
5. Get information in MS Word format:
Python3
print (registry.bibformatters[ 'msword' ](meta( "9788129135728" ))) |
Output: