Python library for interacting with the TIND DA API
Project description
python-tind-client
Python library for interacting with the TIND DA API.
Requirements
- Python 3.12+
Installation
pip install python-tind-client
Install with optional development dependencies:
pip install "python-tind-client[dev]" # test + lint + debug
pip install "python-tind-client[test]" # pytest + requests-mock
pip install "python-tind-client[lint]" # mypy + pydoclint + pylint
pip install "python-tind-client[debug]" # debugpy
Configuration
Create a TINDClient with optional configuration values:
api_key(optional): Your TIND API token. Falls back to theTIND_API_KEYenvironment variable.api_url(optional): Base URL of the TIND instance (e.g.https://tind.example.edu). Falls back to theTIND_API_URLenvironment variable.default_storage_dir(optional): Default output directory for downloaded files. Defaults to./tmp.
Usage
TIND Credentials / Optional ENV config
You will need to either pass your TIND API credentials as arguments when instantiating a TINDClient or set them as environment variables with the following names:
TIND_API_KEYTIND_API_URL
instantiate a client
from tind_client import TINDClient
client = TINDClient(
api_key="your-token",
api_url="https://tind.example.edu",
default_storage_dir="/tmp",
)
Fetch pyMARC metadata for a record
record = client.fetch_metadata("116262")
print(record["245"]["a"]) # title
Fetch file metadata for a record
metadata = client.fetch_file_metadata("116262")
print(metadata[0]) # first file metadata dict
print(metadata[0]["url"]) # file download URL
Download a file
# use metadata from previous example
path_to_download = client.fetch_file(metadata[0]["url"])
Search for records
# return a list of record IDs matching a query
ids = client.fetch_ids_search("collection:'Disabled Students Program Photos'")
# return PyMARC records matching a query
records = client.fetch_search_metadata("collection:'Disabled Students Program Photos'")
# return raw XML or PyMARC records from a paginated search
# NOTE: for large result sets, use the write_search_results_to_file() method and then parse that file
xml_results = client.search("collection:'Disabled Students Program Photos'", result_format="xml")
pymarc_results = client.search("collection:'Disabled Students Program Photos'", result_format="pymarc")
# search Tind with a query and write results to an XML file in the default storage directory
records_written = client.write_search_results_to_file("Old Emperor Norton", "full_norton_results.xml")
# write search results to a specific directory
records_written = client.write_search_results_to_file(
"Old Emperor Norton",
"full_norton_results.xml",
output_dir="/path/to/some/directory"
)
Running tests
pytest
License
MIT — © 2026 The Regents of the University of California
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file python_tind_client-0.2.3.tar.gz.
File metadata
- Download URL: python_tind_client-0.2.3.tar.gz
- Upload date:
- Size: 15.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dfeb0590267c6af5f60832eedb4a7fa4794844cc44bb75066febe9d9698599cc
|
|
| MD5 |
c04df2d95521ee5902a235ecdd362fc7
|
|
| BLAKE2b-256 |
9408970ba6b20c10fb0571c547ca4910e8b28e40b78b3eeabeb1ffcbb5cd3e65
|
Provenance
The following attestation bundles were made for python_tind_client-0.2.3.tar.gz:
Publisher:
release.yml on BerkeleyLibrary/python-tind-client
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
python_tind_client-0.2.3.tar.gz -
Subject digest:
dfeb0590267c6af5f60832eedb4a7fa4794844cc44bb75066febe9d9698599cc - Sigstore transparency entry: 1419450689
- Sigstore integration time:
-
Permalink:
BerkeleyLibrary/python-tind-client@e0b626568d99e47ee867104020ef099a69907ece -
Branch / Tag:
refs/tags/0.2.3 - Owner: https://github.com/BerkeleyLibrary
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@e0b626568d99e47ee867104020ef099a69907ece -
Trigger Event:
push
-
Statement type:
File details
Details for the file python_tind_client-0.2.3-py3-none-any.whl.
File metadata
- Download URL: python_tind_client-0.2.3-py3-none-any.whl
- Upload date:
- Size: 9.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8d5286b1af0df3a87ffc4c80a7199663fb02983dbe2b576601ae76cf50e0e915
|
|
| MD5 |
268b2267bb9f3a066e3037d3a469f194
|
|
| BLAKE2b-256 |
77140f2e95fe0cf250df8f03163a5e09c65a996d03b4bfac0105b409fe90de20
|
Provenance
The following attestation bundles were made for python_tind_client-0.2.3-py3-none-any.whl:
Publisher:
release.yml on BerkeleyLibrary/python-tind-client
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
python_tind_client-0.2.3-py3-none-any.whl -
Subject digest:
8d5286b1af0df3a87ffc4c80a7199663fb02983dbe2b576601ae76cf50e0e915 - Sigstore transparency entry: 1419450992
- Sigstore integration time:
-
Permalink:
BerkeleyLibrary/python-tind-client@e0b626568d99e47ee867104020ef099a69907ece -
Branch / Tag:
refs/tags/0.2.3 - Owner: https://github.com/BerkeleyLibrary
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@e0b626568d99e47ee867104020ef099a69907ece -
Trigger Event:
push
-
Statement type: