forked from KBNLresearch/KB-python-API
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample.py
More file actions
executable file
·29 lines (23 loc) · 793 Bytes
/
example.py
File metadata and controls
executable file
·29 lines (23 loc) · 793 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/usr/bin/env python3
import os
import sys
from kb.nl.api import sru
from kb.nl.api import oai
from kb.nl.helpers import alto_to_text
oai_handler = oai
oai_handler.current_set = "ANP"
oai_handler.set_key("")
response = sru.search("karel AND reve AND hooftprijs", "ANP")
print ("Number of records: %i" % response.sru.nr_of_records)
record_nr = 0
for record in response.records:
record_nr += 1
print("********~ Record number %i ~*********" % record_nr)
print("Date: %s" % record.dates)
print("RecordIdentifier: %s" % record.identifiers)
print("Abstract: %s" % record.abstracts)
print("Title: %s" % record.titles)
oai_handler.DEBUG = True
r = oai_handler.get(record.identifiers[0])
for alto in r.alto:
print("Fulltext: %s" % alto_to_text(alto))