Hello,
Here's the code snippet we use at EPFL for this task:
from invenio.search_engine import search_pattern, print_record
from invenio.bibformat import format_record
import invenio.template
websearch_templates = invenio.template.load('websearch')
out = []
results = search_pattern(p='My pattern', f='field restriction')
out.append(websearch_templates.tmpl_xml_marc_prologue())
for recid in results:
out.append(print_record(recid, 'xm'))
out.append(websearch_templates.tmpl_xml_marc_epilogue())
marc_xml = ''.join(out)
Hope this helps,
Best regards,
Greg
Le 18 nov. 2009 à 10:37, Johnny Mariéthoz a écrit :
> Hello,
>
> I want to get the MarcXml record using the invenio python API.
>
> I suppose that I can use the function:
> perform_request_search
>
> by specifying the option:
> of="xml"
>
> but I need to specify the option:
> req=
>
> How can I create a mod_python Request class instance
> for a command line based python script?
>
> Thanks in advance.
>
> Regards,
> ----------------------------------------------------------------------
> Johnny Mariéthoz
> RERO, Av. de la Gare 45, CH - 1920 MARTIGNY
> Téléphone: +41(0)27 721 8579
> Fax : +41(0)27 721 8586
> Web : http://www.rero.ch
> ReroDoc : http://doc.rero.ch, [email protected]
> ----------------------------------------------------------------------
>
>
____________________________________________________________________
Gregory Favre
Coordinateur Infoscience
École Polytechnique Fédérale de Lausanne
KIS - DIT
Case Postale 121
CH-1015 Lausanne
+41 21 693 22 88
+ 41 79 599 09 06
[email protected]
http://plan.epfl.ch/?sciper=128933
____________________________________________________________________