Giter Club home page Giter Club logo

hathitrust-api's Introduction

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.

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('dul1.ark:/13960/t00z82c1q', 14)

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.']}]}}

Packages:

  • requests (available in PyPI)
  • requests-oauthlib (a Requests plugin; the version in PyPI had some errors, so you may need to get it straight from the source.)

Needed:

  • Write test cases.

hathitrust-api's People

Contributors

rlmv avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.