Skip to content

Instantly share code, notes, and snippets.

@lawlesst
Created July 23, 2011 13:09
  • Star 5 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save lawlesst/1101402 to your computer and use it in GitHub Desktop.
Sample Z39.50 search with Python.
"""
Simple script to search a Z39.50 target using Python
and PyZ3950.
"""
from PyZ3950 import zoom
ISBNs = ['9781905017799', '9780596513986']
conn = zoom.Connection ('z3950.loc.gov', 7090)
conn.databaseName = 'VOYAGER'
conn.preferredRecordSyntax = 'USMARC'
for isbn in ISBNs:
query = zoom.Query ('PQF', '@attr 1=7 %s' % str(isbn))
res = conn.search (query)
for r in res:
print str(r)
conn.close ()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment