Skip to content

Commit ad4e312

Browse files
author
xiffy
committed
resolver voor DPO toegevoegd
1 parent 1eb7ec4 commit ad4e312

File tree

4 files changed

+14
-6
lines changed

4 files changed

+14
-6
lines changed

kb/nl/api/oai.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
OAI_BASEURL = 'http://services.kb.nl/mdo/oai'
88

99

10-
class oai():
10+
class oai:
1111

1212
"""
1313
OAI interface to the National Library of the Netherlands.

kb/nl/api/sru.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import sys
22
import requests
33
import urllib
4-
import pprint
4+
import pprint
55

66
try:
77
from urllib import quote # Python 2.X
@@ -118,7 +118,7 @@ def __next__(self):
118118
return response(record_data, self.sru)
119119
else:
120120
raise StopIteration
121-
121+
122122
def next(self):
123123
return self.__next__()
124124

kb/nl/collections/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
'recordschema': 'ddd',
1414
'setname': 'DPO',
1515
'time_period': [1781, 1800],
16-
'resolver' : ''},
16+
'resolver' : 'http://resolver.kb.nl/resolve?urn='},
1717
'BYVANCK': {'collection': 'BYVANCK',
1818
'description_en': 'Medieval Illuminated Manuscripts',
1919
'description_nl': 'Middeleeuwse Verluchte Handschriften',

kb/nl/helpers/__init__.py

+10-2
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,19 @@
1818
import elementtree.ElementTree as etree
1919
except ImportError:
2020
raise("Failed to import ElementTree from any known place")
21-
21+
import codecs
2222

2323
def alto_to_text(alto_data):
2424
''' Grab the selected text blocks and write them to disk '''
25-
alto_data = etree.fromstring(alto_data.encode('utf-8'))
25+
try:
26+
# some files have a BOM available which does not get stripped on windows
27+
if not alto_data[0] == '<':
28+
alto_data = alto_data[3:]
29+
alto_data = etree.fromstring(alto_data.encode('utf-8'))
30+
31+
except etree.XMLSyntaxError as e:
32+
print ("error! %s" % alto_str[:40])
33+
return None
2634

2735
alto_text = u""
2836
prev_was_hyp = False

0 commit comments

Comments
 (0)