gwu-libraries / oclc-auth-python

OCLC Authentication Library for Python

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

GW Libraries fork of OCLC Python Authentication Library

This library is a fork of https://github.com/OCLC-Developer-Network/oclc-auth-python which itself is a wrapper around the Web Service Authentication system used by OCLC web services, written for Python. It works with versions 2.7 and 3 (up to 3.6).

This library substitutes a GW-specific use case in place of the OCLC examples. It calls the Bibliographic Resource read method from the Worldcat Metadata API, passing it an OCLC number and retrieving the item's MARC data. From the MARC data, it attempts to extract the item's SUDOC number, title, year, and format. The results are written to a CSV file.

Installation

Clone the repository:

git clone https://github.com/OCLC-Developer-Network/oclc-auth-python.git

Set up a virtualenv:

cd oclc-auth-python virtualenv ENV source ENV/bin/activate

Install the authliboclc library:

python setup.py install

Note: While the WorldCat Search API does have a rate limit, the WorldCat Metadata API does not have a rate limit at this time.

Running the Code

  1. Change directories to gw

  2. Edit config.py (copy from example.config.py) and insert your:

    • key
    • secret
    • principal_id
    • principal_idns
    • authenticating_institution_id
    • path to the input file (one clean OCLC id per line - blank lines are okay)
    • path to where you want the output CSV file
  3. Run from the command line:

    python metadata_lookup.py

GW Libraries Users: See Deployment Notes / API Credentials / OCLC for credentials

Resources

About

OCLC Authentication Library for Python

License:Apache License 2.0


Languages

Language:Python 100.0%