Skip to main content

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 the TIND_API_KEY environment variable.
  • api_url (optional): Base URL of the TIND instance (e.g. https://tind.example.edu). Falls back to the TIND_API_URL environment 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_KEY
  • TIND_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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

python_tind_client-0.2.4.tar.gz (15.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

python_tind_client-0.2.4-py3-none-any.whl (9.6 kB view details)

Uploaded Python 3

File details

Details for the file python_tind_client-0.2.4.tar.gz.

File metadata

  • Download URL: python_tind_client-0.2.4.tar.gz
  • Upload date:
  • Size: 15.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for python_tind_client-0.2.4.tar.gz
Algorithm Hash digest
SHA256 c9699c47223491bcb492d457542c9abfa8cabd1a585fffd23b2e3b55639d8166
MD5 558d0c364105cea33a6c4bef79ede7b9
BLAKE2b-256 6458ff98cf0cc6e4f9b43f1291b44a561def3bc227d5128a39b447c8d605e98c

See more details on using hashes here.

Provenance

The following attestation bundles were made for python_tind_client-0.2.4.tar.gz:

Publisher: release.yml on BerkeleyLibrary/python-tind-client

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file python_tind_client-0.2.4-py3-none-any.whl.

File metadata

File hashes

Hashes for python_tind_client-0.2.4-py3-none-any.whl
Algorithm Hash digest
SHA256 52b4a44c33963f682f66d107940766a76c8cd4e3c829d65dd609ccf5f6641b5f
MD5 8de2bca0374472b306f3274deba0fe4c
BLAKE2b-256 43d084f12d38eddff47e8942ae0b94bca1283173595a5223304f8e8024c172ec

See more details on using hashes here.

Provenance

The following attestation bundles were made for python_tind_client-0.2.4-py3-none-any.whl:

Publisher: release.yml on BerkeleyLibrary/python-tind-client

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page