Created
July 23, 2011 13:09
-
-
Save lawlesst/1101402 to your computer and use it in GitHub Desktop.
Sample Z39.50 search with Python.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
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