GithubHelp home page GithubHelp logo

mrjeremyhobbs / alma-sru Goto Github PK

View Code? Open in Web Editor NEW
5.0 1.0 0.0 5 KB

A module for requesting and parsing SRU data from Alma.

License: MIT License

Python 100.00%
alma exlibris library-automation sru

alma-sru's Introduction

Alma-SRU

A module for requesting and parsing SRU data from Alma.

Example - Single Zone Request

from alma.sru import client

isbn = '0738-0895'

# Build SRU request
iz_query = client.make_url(zone="IZ", query=f"alma.isbn={isbn}")

# Make SRU request
iz_query_resp = client.search(iz_query)

# Create SRU response objects
iz = client.parse(iz_query_resp, zone="IZ")

Example - Multi-Zone Async Request

from alma.sru import client

issn = '0738-0895'

# Build SRU requests
iz_query = client.make_url(zone="IZ", query=f"alma.issn={issn}")
nz_query = client.make_url(zone="NZ", query=f"alma.issn={issn}")

# make multiple SRU requests at once
urls = [
    iz_query,
    nz_query,
]

(iz_query_resp,
nz_query_resp) = client.searches(urls, 2)

# create SRU response objects
iz = client.parse(iz_query_resp, zone="IZ")
nz = client.parse(nz_query_resp, zone="NZ")

How to Parse Output

The SRU client will return an SRU object that can be called to get various information about the search result.

How to Parse Search Results

sru_object.numberOfRecords

Returns the number of records found.

sru_object.ok

Is either TRUE (no errors encountered) or FALSE (some errors encountered)

sru_object.errors

Returns any errors encountered.

sru_object.xml

Returns XML representation of SRU response.

sru_object.dict

Returns a dictionary of the SRU response.

sru_object.call_number

Returns the call number.

sru_object.print_holdings

Returns print holdings (if any) for the item as a list, else a blank list.

sru_object.have_e_holdings

Is either TRUE or FALSE.

sru_object.e_holdings

Returns e-holdings (if any) for the item as a list, else a blank list.

alma-sru's People

Contributors

mrjeremyhobbs avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 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.