Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/inspirehep/isbnid
Python ISBN identifier library
https://github.com/inspirehep/isbnid
Last synced: 5 days ago
JSON representation
Python ISBN identifier library
- Host: GitHub
- URL: https://github.com/inspirehep/isbnid
- Owner: inspirehep
- License: gpl-3.0
- Created: 2017-01-09T14:51:50.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2023-01-18T09:46:11.000Z (almost 2 years ago)
- Last Synced: 2024-10-28T13:57:14.840Z (16 days ago)
- Language: Python
- Size: 97.7 KB
- Stars: 1
- Watchers: 19
- Forks: 3
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
isbnid
======Python ISBN identifier library
isbnid is a simple library to handle ISBN identification numbers. isbnid will store, check and convert ISBNs in ISBN10, and ISBN13 formats and it will transform between them and output in URN form.
isbnid can also output ISBN numbers with the correct hyphens corresponding to the actual issuance authorities. The information is retrieved from . ISBN numbers have a complex internal structure which roughly represents the country, the language and the publisher. See also .
Install
-------isbnid has no dependences. The simplest way to install it in python is to execute.
pip install isbnid
It can also be installed from source as
python setup.py install
isbnid is source compatible with both Python 2 and Python 3.
Usage
-----The class isbn.ISBN constructor takes a string containing the ISBN. The string can be inputed in ISBN10, ISBN13 with or without hyphens. It will raise an exception in case it is not formated correctly or the check digit is not valid.
>>> import isbn
>>> isbnid = isbn.ISBN("9780553109535")
>>> isbnid.isbn10()
'0553109537'
>>> isbnid.isbn13()
'9780553109535'
>>> isbnid.urn()
'URN:ISBN:9780553109535'
>>> isbnid.hyphen()
'978-0-553-10953-5'
>>> isbnid = isbn.ISBN("978-0-553-10953-0")
isbn.isbn.ISBNError: 'Invalid ISBN check digit: 978-0-553-10953-0'