BookOps Python wrapper around BPL Solr service.
Requires Python 3.8 & up. Requires credentials from BPL WebApps.
0.5.0
Install via pip:
python -m pip install git+https://github.com/BookOps-CAT/bookops-bpl-solr
Retrieve a specific Sierra bib:
with SolrSession(
authorization="your_client_key", endpoint="solr_endpoint"
) as session:
response = session.search_bibNo(10841318)
print(response.json())
{
"response": {
"numFound": 1,
"start": 0,
"numFoundExact": true,
"docs": [
{
"id": "10841318",
"title": "The Civil War.",
"author_raw": "Robertson, James I.",
"created_date": "2002-08-31T21:14:32Z",
"publishYear": 1963,
"material_type": "Book",
"call_number": "973.7 R651 C",
"language": [
"English"
]
}
]
}
}
Retrieve records matching particular ISBNs:
with SolrSession(authorization="your_client_key", endpoint="solr_endpoint") as session:
response = session.search_isbns(
["9780810984912", "9781419741890", "0810984911"]
print(response.status_code)
print(response.url)
Retrive records by e-content reserve id (037$a MARC tag):
with SolrSession(authorization="your_client_key", endpoint="solr_endpoint") as session:
response = session.search_reserveId("8CD53ED9-CEBD-4F78-8BEF-20A58F6F3857")
Retrieve expired e-content (Overdrive):
with SolrSession(authorization="your_client_key", endpoint="solr_endpoint") as session:
response = session.find_expired_content()
Custom query:
with SolrSession(authorization="your_client_key", endpoint="solr_endpoint") as session:
payload = {
"q": "title:civil AND war",
"fq": "ss_type:catalog",
"fq": "material_type:Book",
"rows": 20,
}
response = session._send_request(payload)
0.5.0 - 2024-11-25
- type annotations where they were missing in
SolrSession
class and methods - py.typed marker so applications using
bookops-bpl-solr
will use the annotations from this package - Python 3.13 to GitHub Actions automated tests
BookopsSolrError
as top-level import per #8
- implicit optional types changed to explicit optional types in
SolrSession
- default value for
SolrSession.timeout
is now(3,3,)
as specified in docstring - changed
if type() is
syntax toif isinstance()
in all type checks inSolrSession
- ignore Flake8 F401 errors in
__init__.py
andtest_bookops_bpl_solr.py
- moved
pytest.ini_options
topyproject.toml
and removedpytest.ini
file - updated authors in
pyproject.toml
per #21 - Updated dependencies:
certifi
(2024.8.30)charset-normalizer
(3.4.0)idna
(3.10)requests
(2.32.3)urllib3
(2.2.3)
- Updated dev depenencies:
click
(8.1.7)colorama
(0.4.6)coverage
(7.6.1)exceptiongroup
(1.2.2)iniconfig
(2.0.0)mypy-extensions
(1.0.0)packaging
(24.2)pathspec
(0.12.1)platformdirs
(4.3.6)pluggy
(1.5.0)pytest-mock
(3.14.0)pytest
(7.4.4)tomli
(2.1.0)types-requests
(2.32.0.241016)typing-extensions
(4.12.2)urllib3
(2.2.3)
- type annotation error for
SolrSession.search_controlNo
.default_response_fields
should bebool
notstr
orlist
- urls in responses of livetests
- unused imports from
session.py
0.4.0 - 2024-1-2
- dev dependencies:
- exceptiongroup (1.2.0)
- dependencies:
- python 3.8
- requests (2.31.0)
- certifi (2023.11.17)
- dev dependencies:
- black (22.12.0)
- pytest (7.4.3)
- pytest-cov (4.1.0)
- pytest-mock (3.12.0)
test_search_controlNo()
edited with updated control numbersconftest.py
path to credentialscoverage
configuration moved from.coveragerc
topyproject.toml
master
branch renamed tomain
- GitHub-Actions updated
- checkout and setup-python actions upgraded to v4
- tests triggered only on push to main and PR to main
- Python 3.11 and 3.12 added to tests
- corrected application of two filters (
fq
) in live test request so both filters are used in a query
- dev dependencies:
- atomicwrites
- attrs
- ghp-import
- importlib-metadata
- py
- toml
- typed-ast
- zipp
0.3.0 - 2022-06-28
search_controlNo()
to query by control number (MARC 001 tag)search_upcs()
to query by UPC number (MARC 024 tag)- dev dependencies:
- mypy (0.961)
- types-requests (2.28.0)
- typing errors in
session.py
0.2.0 - 2022-02-06
- dependencies:
- certifi to 2021.10.8
- requests to 2.27.1
- urllib3 to 1.26.8
- idna to 3.3
- removed mkdocs, mike, mkapi
- CI moved from Travis to Github-Actions
- added Python 3.10
0.1.1 - 2020-10-30
- pyproject.toml python 3.9 compatibility added
- default py 3.8 env
- urllib3 bump from 1.25.10 to 1.25.11