Package gavo :: Package protocols :: Module oaiclient
[frames] | no frames]

Module oaiclient

source code

A simple client of OAI-http.

This includes both some high-level functions and rudimentary parsers that can serve as bases for more specialized parsers.

Classes
  FailedQuery
  NoRecordsMatch
  PrefixIsTaken
  CanonicalPrefixes
a self-persisting dictionary of the prefixes we use in our OAI interface.
  OAIErrorMixin
  IdParser
A parser for simple OAI-PMH headers.
  RecordParser
A simple parser for ivo_vor records.
  OAIRecordsParser
a SAX ContentHandler generating tuples of some record-level metadata and pre-formatted XML of simple implementation of the OAI interface.
  ServerProperties
A container for what an OAI-PMH server gives in response to identify.
  IdentifyParser
A parser for the result of the identify operation.
  OAIQuery
A container for queries to OAI interfaces.
Functions
 
getCanonicalPrefixes() source code
 
getIdentifiers(registry, startDate=None, endDate=None, set=None, granularity=None)
returns a list of "short" records for what's in the registry specified by args.
source code
 
getRecords(registry, startDate=None, endDate=None, set=None, granularity=None)
returns a list of "long" records for what's in the registry specified by args.
source code
 
getRecord(registry, identifier)
returns the XML form of an OAI-PMH record for identifier from the OAI-PMH endpoint at URL registry.
source code
 
parseRecord(recordXML)
returns some main properties from an XML-encoded VOResource record.
source code
 
getServerProperties(registry)
returns a ServerProperties instance for registry.
source code
Variables
  __package__ = 'gavo.protocols'
Function Details

getRecords(registry, startDate=None, endDate=None, set=None, granularity=None)

source code 

returns a list of "long" records for what's in the registry specified by args.

parser should be a subclass of RecordParser; otherwise, you'll miss resumption and possibly other features.

getRecord(registry, identifier)

source code 

returns the XML form of an OAI-PMH record for identifier from the OAI-PMH endpoint at URL registry.

This uses the OAIRecordsParser which enforces canonical prefixes, and the function will add their declarations as necessary. This also means that evil registry records could be broken by us.

parseRecord(recordXML)

source code 

returns some main properties from an XML-encoded VOResource record.

recordXML can be an OAI-PMH response or just a naked record. If multiple records are contained in recordXML, only the first will be returned.

What's coming back is a dictionary as produced by RecordParser.

getServerProperties(registry)

source code 

returns a ServerProperties instance for registry.

In particular, you can retrieve the granularity argument that actually matches the registry from the result's granularity attribute.