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
import sys | |
from pymarc import Record, MARCReader | |
reader = MARCReader(file(sys.argv[1])) | |
print "ALT LOOKUP, Provider, URL" | |
for rec in reader: |
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
#!/usr/bin/env python | |
import sys | |
from pymarc import Field, Reader, Record, MARCWriter | |
import xlrd | |
#script timer | |
import time | |
start_time = time.time() |
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
""" | |
Add below to settings.py | |
AUTHENTICATION_BACKENDS = ( | |
'ldapBackend.LDAPBackend', | |
'django.contrib.auth.backends.ModelBackend', | |
) | |
Requires python-ldap |
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
#pass in elementree tree obj | |
#pass call linked_value('245', subfields=['a', 'c']) | |
def linked_fields(self): | |
linked_fields = [] | |
for field in self.var_fields: | |
rec_tag = field.findtext('MARCINFO/MARCTAG') | |
if '880' == rec_tag: | |
linked_fields.append((field.findall('MARCSUBFLD'), field)) |
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
from xml.etree.ElementTree import ElementTree | |
import urllib | |
source_url = 'http://etd.lib.montana.edu/etd/view/locations-markers.php' | |
source = urllib.urlopen(source_url) | |
tree = ElementTree() | |
doc = tree.parse(source) | |
print'<?xml version="1.0" encoding="UTF-8"?>' |
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
""" | |
Search Summon API with Python. | |
See Dough Chesnut's Code4Lib mailing list post: http://serials.infomotions.com/code4lib/archive/2010/201010/2408.html | |
""" | |
import httplib2 | |
import urllib | |
from datetime import datetime | |
import hmac | |
import base64 | |
import hashlib |
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
class Accession(models.Model): | |
"""Sample for recording library statistics. | |
Use indexes for faster query time..""" | |
number = models.CharField(max_length=15, primary_key=True) | |
created = models.DateField(db_index=True) | |
acquisition_method = models.CharField(max_length=50, db_index=True) | |
format = models.CharField(max_length=50, db_index=True) | |
location = models.CharField(max_length=50, db_index=True) | |
volumes = models.IntegerField() |
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'] |
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
import xlrd, sys | |
from pymarc import Field, Reader, Record, MARCWriter | |
#script timer | |
import time | |
start_time = time.time() | |
"""Script that reads data from an Excel sheet and converts the records to MARC format. | |
Sample incoming data is in Chinese, UTF 8. Would work for other languages as well. |
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
import sys | |
import csv | |
csv_file = csv.DictReader(open(sys.argv[1])) | |
for row in csv_file: | |
print row['bluebook'], row['journal'] |
OlderNewer