Commit f49d5b68 authored by LE GAC Renaud's avatar LE GAC Renaud
Browse files

Add the helper function load_record in the modules invenio_tools.

parent 77343b20
......@@ -14,3 +14,21 @@ from checkandfix import CheckAndFix
from inveniostore import InvenioStore
from marc12 import Marc12
from record import Record
def load_record(host, record_id):
"""Load a record from an invenio store
Args:
host (str): host of the store. Either cds.cern.ch or inspirhep.net.
record_id (integer): the record identifier
Returns:
Record: the decoded record
"""
store = InvenioStore(host)
xml = store.get_record(record_id)
svc = Marc12()
return svc(xml)[0]
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment