metaodi / sruthi

SRU (Search/Retrieve via URL) client library for Python
MIT License
9 stars 3 forks source link

Fixing #28 #29

Closed edipretoro closed 4 years ago

edipretoro commented 4 years ago

Fixing #28

Here is a trace:

In [2]: import pprint, sruthi

In [3]: records = sruthi.searchretrieve('http://catalogue.bnf.fr/api/SRU', query='bib.isbn="9782412049402"', operation="sea
   ...: rchRetrieve")

In [4]: for r in records:
   ...:     pprint.pprint(r)
   ...:
{'controlfield': 'http://catalogue.bnf.fr/ark:/12148/cb458320986',
 'extra': {'attr': '20200117', 'score': '6.3563447'},
 'leader': 'cam  22        450',
 'schema': 'marcxchange',
 'subfield': 'O'}

And with the recordSchema parameter:

In [5]: records = sruthi.searchretrieve('http://catalogue.bnf.fr/api/SRU', query='bib.isbn="9782412049402"', operation="sea
   ...: rchRetrieve", recordSchema='dublincore')

In [6]: for r in records:
   ...:     pprint.pprint(r)
   ...:
{'creator': 'Olicard, Fabien. Auteur du texte',
 'date': '2019',
 'description': 'Code à barres commercial : EAN 9782412049402',
 'extra': {'attr': '20200117', 'score': '6.3563447'},
 'format': '1 vol. (250 p.) : ill. ; 23 cm',
 'identifier': 'ISBN 9782412049402',
 'language': 'français',
 'publisher': 'First éditions (Paris)',
 'rights': 'French National Library online Catalog',
 'schema': 'dc',
 'subject': 'Réalisation de soi',
 'title': 'Votre temps est infini : et si votre journée était plus longue que '
          'vous ne le pensiez ? / Fabien Olicard',
 'type': 'text'}