Skip to content

Instantly share code, notes, and snippets.

@mromanello
Created October 18, 2011 14:43
Show Gist options
  • Save mromanello/1295608 to your computer and use it in GitHub Desktop.
Save mromanello/1295608 to your computer and use it in GitHub Desktop.
Poking around with the Infrae OAI-PMH client module
from oaipmh.client import Client
from oaipmh.metadata import MetadataRegistry, oai_dc_reader
zenon_URL = "http://opac.dainst.org/OAI"
dai_URL = "http://arachne.uni-koeln.de:8080/OAI-PMH/oai-pmh.xml"
oc_URL="http://opencontext.org/oai/request"
registry = MetadataRegistry()
registry.registerReader('oai_dc', oai_dc_reader)
client = Client(oc_URL, registry)
meta_pref=('marc21',"oai_dc")
for mf in list(client.listMetadataFormats()):
print mf
#meta_pref=('marc21',"oai_dc")
for record in client.listRecords(metadataPrefix=meta_pref[1]):
record=record[0]
print record.identifier()
result = client.getRecord(identifier=record.identifier(),metadataPrefix="oai_dc")
print result[0]
print result[1].getMap()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment