Skip to main content

hathitrust-api

A simple interface for the HathiTrust APIs. The package contains basic classes and associated methods for querying the Bibliographic API, Data API, and the HTRC Solr Proxy.

The package is compatible with Python 2 and Python 3.

Installation

Clone and install from this repository:

git clone https://github.com/rlmv/hathitrust-api.git
cd hathitrust-api
python setup.py install

Or install directly using pip:

pip install hathitrust-api

DataAPI

The Data API retrieves non-google public domain works from the HathiTrust.

An OAuth keyset from HathiTrust is required to use the Data API.

Example usage:

>>> from hathitrust_api import DataAPI
>>> data_api = DataAPI(your_oauth_key, your_oauth_secret)
>>> ocrtext = data_api.getpageocr('nyp.33433082228226', 120)

BibAPI

The bibliographic API delivers HathiTrust bibliographic data and MARC records in JSON format.

Example:

>>> from hathitrust_api import BibAPI
>>> bib_api = BibAPI()
>>> bib_info = bib_api.get_single_record_json('htid', 'dul1.ark:/13960/t00z82c1q')
>>> bib_info.keys()
[u'records', u'items']
>>> bib_info['records']['010944133']['publishDates']
[u'1670']

SolrAPI

The HTRC Solr Proxy is a search index over the public domain collection.

>>> from hathitrust_api import SolrAPI
>>> solr = SolrAPI()
>>> results = solr.query("new zealand", fields=['title'])
>>> results
{u'responseHeader': {u'status': 0, u'QTime': 19}, u'response': {u'start': 0, u'numFound': 366613, u'docs': [{u'title': [u'The statues of New Zealand ...']}, {u'title': [u'New Zealand.']}, {u'title': [u"Wise's New Zealand index"]}, {u'title': [u'Palaeontological bulletin.']}, {u'title': [u'New Zealand,']}, {u'title': [u'The New Zealand official year-book.']}, {u'title': [u'The New Zealand official year-book.']}, {u'title': [u'The New Zealand official year-book.']}, {u'title': [u'The New Zealand official year-book.']}, {u'title': [u'The New Zealand official year-book.']}]}}

Needed:

  • Write test cases.

Metadata

Release files for hathitrust-api 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for hathitrust-api 0.1.1
File Size Uploaded Provenance Actions
hathitrust_api-0.1.1.tar.gz 7.1 kB Without provenance Details for hathitrust_api-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for hathitrust-api 0.1.1
File Interpreter ABI Platform Actions
hathitrust_api-0.1.1-py3-none-any.whl Python 3 none any Details for hathitrust_api-0.1.1-py3-none-any.whl

Total release size: 14.8 kB

Release files / hathitrust_api-0.1.1.tar.gz

Download URL hathitrust_api-0.1.1.tar.gz
Size 7.1 kB
Tags Source
SHA-256 checksum
How to use checksums
ee9de3b2d77587b967355eeb1ebfafe70078607885a7af8a676644ab99b8e9d7
BLAKE2b-256 checksum
How to use checksums
3138f8ccae2e3e63813d875ff8d7c37db0983270f120204fe2a5d466b68b105d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / hathitrust_api-0.1.1-py3-none-any.whl

Download URL hathitrust_api-0.1.1-py3-none-any.whl
Size 7.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a1fd1d97cff4eeb27feee0747b177d9d5ecfa4bc599039762124725d3c639059
BLAKE2b-256 checksum
How to use checksums
c58efc31f51f9e24d63627d899b168aef3f653139ed3d48f3c40d1e3d834553c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for hathitrust-api 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page