isbnlab 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. isbnlab-0.1.0/.gitignore +9 -0
  2. isbnlab-0.1.0/LICENSE +21 -0
  3. isbnlab-0.1.0/PKG-INFO +126 -0
  4. isbnlab-0.1.0/README.md +98 -0
  5. isbnlab-0.1.0/isbnlab/__init__.py +102 -0
  6. isbnlab-0.1.0/isbnlab/api/__init__.py +10 -0
  7. isbnlab-0.1.0/isbnlab/api/authors_api.py +587 -0
  8. isbnlab-0.1.0/isbnlab/api/books_api.py +2285 -0
  9. isbnlab-0.1.0/isbnlab/api/genres_api.py +587 -0
  10. isbnlab-0.1.0/isbnlab/api/isbn_api.py +1957 -0
  11. isbnlab-0.1.0/isbnlab/api/publishers_api.py +879 -0
  12. isbnlab-0.1.0/isbnlab/api/subjects_api.py +587 -0
  13. isbnlab-0.1.0/isbnlab/api_client.py +802 -0
  14. isbnlab-0.1.0/isbnlab/api_response.py +21 -0
  15. isbnlab-0.1.0/isbnlab/configuration.py +611 -0
  16. isbnlab-0.1.0/isbnlab/exceptions.py +217 -0
  17. isbnlab-0.1.0/isbnlab/models/__init__.py +39 -0
  18. isbnlab-0.1.0/isbnlab/models/author.py +144 -0
  19. isbnlab-0.1.0/isbnlab/models/author_photo.py +128 -0
  20. isbnlab-0.1.0/isbnlab/models/book.py +435 -0
  21. isbnlab-0.1.0/isbnlab/models/book_cover.py +100 -0
  22. isbnlab-0.1.0/isbnlab/models/book_editions.py +128 -0
  23. isbnlab-0.1.0/isbnlab/models/category.py +107 -0
  24. isbnlab-0.1.0/isbnlab/models/contributor.py +114 -0
  25. isbnlab-0.1.0/isbnlab/models/edition_ref.py +142 -0
  26. isbnlab-0.1.0/isbnlab/models/entity_ref.py +107 -0
  27. isbnlab-0.1.0/isbnlab/models/genre.py +107 -0
  28. isbnlab-0.1.0/isbnlab/models/isbn_details.py +184 -0
  29. isbnlab-0.1.0/isbnlab/models/other_series.py +139 -0
  30. isbnlab-0.1.0/isbnlab/models/publisher.py +128 -0
  31. isbnlab-0.1.0/isbnlab/models/rating_counts.py +121 -0
  32. isbnlab-0.1.0/isbnlab/models/rating_summary.py +107 -0
  33. isbnlab-0.1.0/isbnlab/models/ratings.py +108 -0
  34. isbnlab-0.1.0/isbnlab/models/retail_link.py +100 -0
  35. isbnlab-0.1.0/isbnlab/models/series.py +175 -0
  36. isbnlab-0.1.0/isbnlab/models/series_book.py +135 -0
  37. isbnlab-0.1.0/isbnlab/models/series_parent.py +107 -0
  38. isbnlab-0.1.0/isbnlab/models/subject.py +121 -0
  39. isbnlab-0.1.0/isbnlab/models/subject_ref.py +114 -0
  40. isbnlab-0.1.0/isbnlab/py.typed +0 -0
  41. isbnlab-0.1.0/isbnlab/rest.py +259 -0
  42. isbnlab-0.1.0/pyproject.toml +47 -0
@@ -0,0 +1,9 @@
1
+ __pycache__/
2
+ *.py[cod]
3
+ *.egg-info/
4
+ .venv/
5
+ venv/
6
+ build/
7
+ dist/
8
+ .pytest_cache/
9
+ .idea/
isbnlab-0.1.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 RINC Productions, LLC (ISBNLab)
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
isbnlab-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,126 @@
1
+ Metadata-Version: 2.5
2
+ Name: isbnlab
3
+ Version: 0.1.0
4
+ Summary: Official Python client for the ISBNLab book metadata API: books by ISBN, authors, publishers, BISAC genres, covers and ISBN conversion.
5
+ Project-URL: Homepage, https://www.isbnlab.com/
6
+ Project-URL: Documentation, https://www.isbnlab.com/api-information
7
+ Project-URL: Repository, https://github.com/isbnlab/isbnlab-python
8
+ Project-URL: Issues, https://github.com/isbnlab/isbnlab-python/issues
9
+ Author-email: ISBNLab <hello@isbnlab.com>
10
+ License-Expression: MIT
11
+ License-File: LICENSE
12
+ Keywords: api-client,bisac,book-metadata,books,isbn,isbn-10,isbn-13,isbn-lookup
13
+ Classifier: Development Status :: 4 - Beta
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: Operating System :: OS Independent
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3 :: Only
18
+ Classifier: Topic :: Software Development :: Libraries
19
+ Classifier: Typing :: Typed
20
+ Requires-Python: >=3.10
21
+ Requires-Dist: pydantic>=2
22
+ Requires-Dist: python-dateutil>=2.8.2
23
+ Requires-Dist: typing-extensions>=4.7.1
24
+ Requires-Dist: urllib3<3.0.0,>=2.1.0
25
+ Provides-Extra: test
26
+ Requires-Dist: pytest>=7; extra == 'test'
27
+ Description-Content-Type: text/markdown
28
+
29
+ # ISBNLab Python client
30
+
31
+ The official Python client for the [ISBNLab book metadata API](https://www.isbnlab.com/api-information). Look up a book by ISBN and get its title, authors, publishers, series, BISAC genres, formats, page count, description and every other edition, from a catalog of more than 100 million editions. It also validates and converts ISBN-10, ISBN-13, EAN and Amazon ASIN.
32
+
33
+ ## Install
34
+
35
+ ```bash
36
+ pip install isbnlab
37
+ ```
38
+
39
+ Python 3.10 or later.
40
+
41
+ ## Get an API token
42
+
43
+ [Create a free ISBNLab account](https://www.isbnlab.com/register) and copy your API token from your profile. The Free plan includes 1,000 calls a day; see [pricing](https://www.isbnlab.com/pricing) for more.
44
+
45
+ ## Quick start
46
+
47
+ ```python
48
+ import os
49
+ import isbnlab
50
+
51
+ config = isbnlab.Configuration(access_token=os.environ["ISBNLAB_API_TOKEN"])
52
+
53
+ with isbnlab.ApiClient(config) as client:
54
+ books = isbnlab.BooksApi(client)
55
+ book = books.get_book_by_isbn("9780765302304")
56
+
57
+ print(book.title) # The Gathering Storm
58
+ print(book.authors[0].name) # Robert Jordan
59
+ print(book.publish_date.year if book.publish_date else None)
60
+
61
+ for edition in book.other_editions or []:
62
+ print(edition.isbn13, edition.title)
63
+ ```
64
+
65
+ Many fields are empty for some books, so every field can be `None`. Field names are snake_case (`book.number_of_pages`, `book.other_editions`); `book.to_dict()` gives the API's own camelCase names.
66
+
67
+ Linked records carry ids you can look up directly (author, publisher, subject and genre lookups need a Standard or Pro plan):
68
+
69
+ ```python
70
+ with isbnlab.ApiClient(config) as client:
71
+ book = isbnlab.BooksApi(client).get_book_by_isbn("9780765302304")
72
+ author = isbnlab.AuthorsApi(client).get_author(str(book.authors[0].id))
73
+
74
+ print(author.bio)
75
+ ```
76
+
77
+ ## Errors
78
+
79
+ Any response other than 2xx raises `isbnlab.ApiException` (or a subclass such as `NotFoundException` or `ForbiddenException`). It carries the HTTP status, the headers, and the response body, whose `detail` explains the reason:
80
+
81
+ ```python
82
+ from isbnlab import ApiException
83
+
84
+ try:
85
+ book = books.get_book_by_isbn("9780000000000")
86
+ except ApiException as e:
87
+ if e.status == 404:
88
+ print("Not in the catalog")
89
+ elif e.status == 429:
90
+ print("Daily limit reached; retry after", e.headers.get("Retry-After"), "seconds")
91
+ elif e.status == 403:
92
+ print("Your plan does not include this endpoint")
93
+ else:
94
+ raise
95
+ ```
96
+
97
+ ## What you can call
98
+
99
+ | Class | Method | Plan |
100
+ |---|---|---|
101
+ | `BooksApi` | `get_book_by_isbn(isbn)`, `get_book_by_asin(asin)`, `get_book_by_id(id)` | Free |
102
+ | `IsbnApi` | `parse_isbn`, `isbn10_to_isbn13`, `isbn13_to_isbn10`, `isbn_to_ean`, `ean_to_isbn`, `isbn_to_asin`, `asin_to_isbn` | Free |
103
+ | `BooksApi` | `get_book_cover_by_isbn(isbn)`, `get_book_cover_by_asin(asin)` | Standard |
104
+ | `AuthorsApi` | `get_author(id)`, `find_author(search)` | Standard |
105
+ | `PublishersApi` | `get_publisher(id)`, `find_publisher(search)`, `get_publishers_by_prefix(prefix)` | Standard |
106
+ | `SubjectsApi` | `get_subject(id)`, `find_subject(search)` | Standard |
107
+ | `GenresApi` | `get_genre(id)`, `find_genre(search)` (name or BISAC code) | Standard |
108
+ | `BooksApi` | `search_books(query, limit=, page=, max_results=)` | Pro |
109
+ | `BooksApi` | `get_editions_by_isbn(isbn)`, `get_editions_by_asin(asin)` | Pro |
110
+
111
+ Every method also has a `..._with_http_info()` version that returns the status code and headers as well (for example the rate-limit headers).
112
+
113
+ Reference for every method and model: [docs/](docs/). Field-by-field documentation: [API documentation](https://www.isbnlab.com/api-information).
114
+
115
+ ## Development
116
+
117
+ `isbnlab/` and `docs/` are generated from the API's [OpenAPI document](https://www.isbnlab.com/api/docs.jsonopenapi) with [OpenAPI Generator](https://openapi-generator.tech/), so changes to them are made in the generator and arrive with the next release; please open an issue rather than a pull request for those folders. `README.md`, `pyproject.toml` and `tests/` are maintained by hand.
118
+
119
+ ```bash
120
+ pip install -e ".[test]"
121
+ pytest
122
+ ```
123
+
124
+ ## License
125
+
126
+ MIT. Maintained by [ISBNLab](https://www.isbnlab.com/), the book metadata API.
@@ -0,0 +1,98 @@
1
+ # ISBNLab Python client
2
+
3
+ The official Python client for the [ISBNLab book metadata API](https://www.isbnlab.com/api-information). Look up a book by ISBN and get its title, authors, publishers, series, BISAC genres, formats, page count, description and every other edition, from a catalog of more than 100 million editions. It also validates and converts ISBN-10, ISBN-13, EAN and Amazon ASIN.
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ pip install isbnlab
9
+ ```
10
+
11
+ Python 3.10 or later.
12
+
13
+ ## Get an API token
14
+
15
+ [Create a free ISBNLab account](https://www.isbnlab.com/register) and copy your API token from your profile. The Free plan includes 1,000 calls a day; see [pricing](https://www.isbnlab.com/pricing) for more.
16
+
17
+ ## Quick start
18
+
19
+ ```python
20
+ import os
21
+ import isbnlab
22
+
23
+ config = isbnlab.Configuration(access_token=os.environ["ISBNLAB_API_TOKEN"])
24
+
25
+ with isbnlab.ApiClient(config) as client:
26
+ books = isbnlab.BooksApi(client)
27
+ book = books.get_book_by_isbn("9780765302304")
28
+
29
+ print(book.title) # The Gathering Storm
30
+ print(book.authors[0].name) # Robert Jordan
31
+ print(book.publish_date.year if book.publish_date else None)
32
+
33
+ for edition in book.other_editions or []:
34
+ print(edition.isbn13, edition.title)
35
+ ```
36
+
37
+ Many fields are empty for some books, so every field can be `None`. Field names are snake_case (`book.number_of_pages`, `book.other_editions`); `book.to_dict()` gives the API's own camelCase names.
38
+
39
+ Linked records carry ids you can look up directly (author, publisher, subject and genre lookups need a Standard or Pro plan):
40
+
41
+ ```python
42
+ with isbnlab.ApiClient(config) as client:
43
+ book = isbnlab.BooksApi(client).get_book_by_isbn("9780765302304")
44
+ author = isbnlab.AuthorsApi(client).get_author(str(book.authors[0].id))
45
+
46
+ print(author.bio)
47
+ ```
48
+
49
+ ## Errors
50
+
51
+ Any response other than 2xx raises `isbnlab.ApiException` (or a subclass such as `NotFoundException` or `ForbiddenException`). It carries the HTTP status, the headers, and the response body, whose `detail` explains the reason:
52
+
53
+ ```python
54
+ from isbnlab import ApiException
55
+
56
+ try:
57
+ book = books.get_book_by_isbn("9780000000000")
58
+ except ApiException as e:
59
+ if e.status == 404:
60
+ print("Not in the catalog")
61
+ elif e.status == 429:
62
+ print("Daily limit reached; retry after", e.headers.get("Retry-After"), "seconds")
63
+ elif e.status == 403:
64
+ print("Your plan does not include this endpoint")
65
+ else:
66
+ raise
67
+ ```
68
+
69
+ ## What you can call
70
+
71
+ | Class | Method | Plan |
72
+ |---|---|---|
73
+ | `BooksApi` | `get_book_by_isbn(isbn)`, `get_book_by_asin(asin)`, `get_book_by_id(id)` | Free |
74
+ | `IsbnApi` | `parse_isbn`, `isbn10_to_isbn13`, `isbn13_to_isbn10`, `isbn_to_ean`, `ean_to_isbn`, `isbn_to_asin`, `asin_to_isbn` | Free |
75
+ | `BooksApi` | `get_book_cover_by_isbn(isbn)`, `get_book_cover_by_asin(asin)` | Standard |
76
+ | `AuthorsApi` | `get_author(id)`, `find_author(search)` | Standard |
77
+ | `PublishersApi` | `get_publisher(id)`, `find_publisher(search)`, `get_publishers_by_prefix(prefix)` | Standard |
78
+ | `SubjectsApi` | `get_subject(id)`, `find_subject(search)` | Standard |
79
+ | `GenresApi` | `get_genre(id)`, `find_genre(search)` (name or BISAC code) | Standard |
80
+ | `BooksApi` | `search_books(query, limit=, page=, max_results=)` | Pro |
81
+ | `BooksApi` | `get_editions_by_isbn(isbn)`, `get_editions_by_asin(asin)` | Pro |
82
+
83
+ Every method also has a `..._with_http_info()` version that returns the status code and headers as well (for example the rate-limit headers).
84
+
85
+ Reference for every method and model: [docs/](docs/). Field-by-field documentation: [API documentation](https://www.isbnlab.com/api-information).
86
+
87
+ ## Development
88
+
89
+ `isbnlab/` and `docs/` are generated from the API's [OpenAPI document](https://www.isbnlab.com/api/docs.jsonopenapi) with [OpenAPI Generator](https://openapi-generator.tech/), so changes to them are made in the generator and arrive with the next release; please open an issue rather than a pull request for those folders. `README.md`, `pyproject.toml` and `tests/` are maintained by hand.
90
+
91
+ ```bash
92
+ pip install -e ".[test]"
93
+ pytest
94
+ ```
95
+
96
+ ## License
97
+
98
+ MIT. Maintained by [ISBNLab](https://www.isbnlab.com/), the book metadata API.
@@ -0,0 +1,102 @@
1
+ # coding: utf-8
2
+
3
+ # flake8: noqa
4
+
5
+ """
6
+ ISBNLab API
7
+
8
+ Book metadata by ISBN: books, editions, covers, authors, publishers, subjects, BISAC genres, and ISBN validation and conversion.
9
+
10
+ The version of the OpenAPI document: 1.0.0
11
+ Contact: hello@isbnlab.com
12
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
13
+
14
+ Do not edit the class manually.
15
+ """ # noqa: E501
16
+
17
+
18
+ __version__ = "0.1.0"
19
+
20
+ # Define package exports
21
+ __all__ = [
22
+ "AuthorsApi",
23
+ "BooksApi",
24
+ "GenresApi",
25
+ "IsbnApi",
26
+ "PublishersApi",
27
+ "SubjectsApi",
28
+ "ApiResponse",
29
+ "ApiClient",
30
+ "Configuration",
31
+ "OpenApiException",
32
+ "ApiTypeError",
33
+ "ApiValueError",
34
+ "ApiKeyError",
35
+ "ApiAttributeError",
36
+ "ApiException",
37
+ "Author",
38
+ "AuthorPhoto",
39
+ "Book",
40
+ "BookCover",
41
+ "BookEditions",
42
+ "Category",
43
+ "Contributor",
44
+ "EditionRef",
45
+ "EntityRef",
46
+ "Genre",
47
+ "IsbnDetails",
48
+ "OtherSeries",
49
+ "Publisher",
50
+ "RatingCounts",
51
+ "RatingSummary",
52
+ "Ratings",
53
+ "RetailLink",
54
+ "Series",
55
+ "SeriesBook",
56
+ "SeriesParent",
57
+ "Subject",
58
+ "SubjectRef",
59
+ ]
60
+
61
+ # import apis into sdk package
62
+ from isbnlab.api.authors_api import AuthorsApi as AuthorsApi
63
+ from isbnlab.api.books_api import BooksApi as BooksApi
64
+ from isbnlab.api.genres_api import GenresApi as GenresApi
65
+ from isbnlab.api.isbn_api import IsbnApi as IsbnApi
66
+ from isbnlab.api.publishers_api import PublishersApi as PublishersApi
67
+ from isbnlab.api.subjects_api import SubjectsApi as SubjectsApi
68
+
69
+ # import ApiClient
70
+ from isbnlab.api_response import ApiResponse as ApiResponse
71
+ from isbnlab.api_client import ApiClient as ApiClient
72
+ from isbnlab.configuration import Configuration as Configuration
73
+ from isbnlab.exceptions import OpenApiException as OpenApiException
74
+ from isbnlab.exceptions import ApiTypeError as ApiTypeError
75
+ from isbnlab.exceptions import ApiValueError as ApiValueError
76
+ from isbnlab.exceptions import ApiKeyError as ApiKeyError
77
+ from isbnlab.exceptions import ApiAttributeError as ApiAttributeError
78
+ from isbnlab.exceptions import ApiException as ApiException
79
+
80
+ # import models into sdk package
81
+ from isbnlab.models.author import Author as Author
82
+ from isbnlab.models.author_photo import AuthorPhoto as AuthorPhoto
83
+ from isbnlab.models.book import Book as Book
84
+ from isbnlab.models.book_cover import BookCover as BookCover
85
+ from isbnlab.models.book_editions import BookEditions as BookEditions
86
+ from isbnlab.models.category import Category as Category
87
+ from isbnlab.models.contributor import Contributor as Contributor
88
+ from isbnlab.models.edition_ref import EditionRef as EditionRef
89
+ from isbnlab.models.entity_ref import EntityRef as EntityRef
90
+ from isbnlab.models.genre import Genre as Genre
91
+ from isbnlab.models.isbn_details import IsbnDetails as IsbnDetails
92
+ from isbnlab.models.other_series import OtherSeries as OtherSeries
93
+ from isbnlab.models.publisher import Publisher as Publisher
94
+ from isbnlab.models.rating_counts import RatingCounts as RatingCounts
95
+ from isbnlab.models.rating_summary import RatingSummary as RatingSummary
96
+ from isbnlab.models.ratings import Ratings as Ratings
97
+ from isbnlab.models.retail_link import RetailLink as RetailLink
98
+ from isbnlab.models.series import Series as Series
99
+ from isbnlab.models.series_book import SeriesBook as SeriesBook
100
+ from isbnlab.models.series_parent import SeriesParent as SeriesParent
101
+ from isbnlab.models.subject import Subject as Subject
102
+ from isbnlab.models.subject_ref import SubjectRef as SubjectRef
@@ -0,0 +1,10 @@
1
+ # flake8: noqa
2
+
3
+ # import apis into api package
4
+ from isbnlab.api.authors_api import AuthorsApi
5
+ from isbnlab.api.books_api import BooksApi
6
+ from isbnlab.api.genres_api import GenresApi
7
+ from isbnlab.api.isbn_api import IsbnApi
8
+ from isbnlab.api.publishers_api import PublishersApi
9
+ from isbnlab.api.subjects_api import SubjectsApi
10
+