forked from KBNLresearch/KB-python-API
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsru_test.py
More file actions
executable file
·30 lines (26 loc) · 2.07 KB
/
Copy pathsru_test.py
File metadata and controls
executable file
·30 lines (26 loc) · 2.07 KB
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
30
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
sys.path.append('..' + os.sep)
sys.path.append('.' + os.sep)
def oai_anp():
"""
>>> from kb.nl.api import sru
>>> from kb.nl.helpers import alto_to_text
>>> sru.DEBUG=True
>>> response = sru.search("beatrix AND juliana AND Bernhard AND gelukwensen", "ANP")
http://jsru.kb.nl/sru/sru?version=1.2&maximumRecords=1&operation=searchRetrieve&startRecord=1&recordSchema=dcx&x-collection=ANP&query=beatrix+AND+juliana+AND+Bernhard+AND+gelukwensen
>>> for record in response.records:
... print(record.date)
http://jsru.kb.nl/sru/sru?version=1.2&maximumRecords=1&operation=searchRetrieve&startRecord=1&recordSchema=dcx&x-collection=ANP&query=beatrix+AND+juliana+AND+Bernhard+AND+gelukwensen1967/04/28 00:00:00
http://jsru.kb.nl/sru/sru?version=1.2&maximumRecords=1&operation=searchRetrieve&startRecord=2&recordSchema=dcx&x-collection=ANP&query=beatrix+AND+juliana+AND+Bernhard+AND+gelukwensen1968/09/25 00:00:00
http://jsru.kb.nl/sru/sru?version=1.2&maximumRecords=1&operation=searchRetrieve&startRecord=3&recordSchema=dcx&x-collection=ANP&query=beatrix+AND+juliana+AND+Bernhard+AND+gelukwensen1966/02/21 00:00:00
http://jsru.kb.nl/sru/sru?version=1.2&maximumRecords=1&operation=searchRetrieve&startRecord=4&recordSchema=dcx&x-collection=ANP&query=beatrix+AND+juliana+AND+Bernhard+AND+gelukwensen1966/03/10 00:00:00
http://jsru.kb.nl/sru/sru?version=1.2&maximumRecords=1&operation=searchRetrieve&startRecord=5&recordSchema=dcx&x-collection=ANP&query=beatrix+AND+juliana+AND+Bernhard+AND+gelukwensen1966/03/09 00:00:00
http://jsru.kb.nl/sru/sru?version=1.2&maximumRecords=1&operation=searchRetrieve&startRecord=6&recordSchema=dcx&x-collection=ANP&query=beatrix+AND+juliana+AND+Bernhard+AND+gelukwensen1969/10/11 00:00:00
http://jsru.kb.nl/sru/sru?version=1.2&maximumRecords=1&operation=searchRetrieve&startRecord=7&recordSchema=dcx&x-collection=ANP&query=beatrix+AND+juliana+AND+Bernhard+AND+gelukwensen1965/06/29 00:00:00
"""
if __name__ == "__main__":
import doctest
doctest.testmod()