Access to National Library of the Netherlands data
Project description
=================================================================
KB python API: Access to National Library of the Netherlands data
=================================================================
KB-Python-API is a simple API for Python, the API provides easy access to free and CC-BY-NC-ND datasets provided by the National Library of the Netherlands (KB).
It relies on the back-end infrastructure of the KB which consists of an SRU and OAI-MPH service. The KB Python API makes it easy to interact with historical data, for more information on the provided datasets and data-rights take a look at the DataServices_ page of the KB.
Currently only the OAI part is implemented.
OAI example
===========
>>> from kb.nl.api import oai
>>> from kb.nl.helpers import alto_to_text
>>> oai.list_sets()
['ANP', 'BYVANCK', 'DPO', 'SGD']
>>> records = oai.list_records("ANP")
>>> records.identifiers[:3]
['anp:1937:10:01:1', 'anp:1937:10:01:2', 'anp:1937:10:01:3']
>>> len(oai.resumptiontoken)
42
>>> record = oai.get(records.identifiers[0])
>>> alto_record = record.alto
>>> alto_to_text(alto_records[0]).split("\\n")[1][:27]
u' RADIO 1 van 1 Ootober 1937'
>>> image_record = record.image
>>> len(image_record)
721035
KB python API: Access to National Library of the Netherlands data
=================================================================
KB-Python-API is a simple API for Python, the API provides easy access to free and CC-BY-NC-ND datasets provided by the National Library of the Netherlands (KB).
It relies on the back-end infrastructure of the KB which consists of an SRU and OAI-MPH service. The KB Python API makes it easy to interact with historical data, for more information on the provided datasets and data-rights take a look at the DataServices_ page of the KB.
Currently only the OAI part is implemented.
OAI example
===========
>>> from kb.nl.api import oai
>>> from kb.nl.helpers import alto_to_text
>>> oai.list_sets()
['ANP', 'BYVANCK', 'DPO', 'SGD']
>>> records = oai.list_records("ANP")
>>> records.identifiers[:3]
['anp:1937:10:01:1', 'anp:1937:10:01:2', 'anp:1937:10:01:3']
>>> len(oai.resumptiontoken)
42
>>> record = oai.get(records.identifiers[0])
>>> alto_record = record.alto
>>> alto_to_text(alto_records[0]).split("\\n")[1][:27]
u' RADIO 1 van 1 Ootober 1937'
>>> image_record = record.image
>>> len(image_record)
721035
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
kb-0.1dev.tar.gz
(5.1 kB
view hashes)