metaodi / sruthi

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

sruthri is not working with some SRU servers #26

Closed edipretoro closed 4 years ago

edipretoro commented 4 years ago

I've tested your module with the SRU server of the BnF (http://catalogue.bnf.fr/api/SRU), and it doesn't work.

Here is a trace:

In [8]: records = sruthi.searchretrieve('http://catalogue.bnf.fr/api/SRU', query='bib.isbn="9782412049402"')
/Users/edipretoro/projects/sruthi/sruthi/response.py:31: WrongNamespaceWarning:
                    The server has the wrong namespace for SRU,
                    it should be {http://www.loc.gov/zing/srw/} but it's currently set to {http://www.loc.gov/zing/srw/}.

  warnings.warn(

And yet, here is the equivalent working link: http://catalogue.bnf.fr/api/SRU?version=1.2&operation=searchRetrieve&query=bib.isbn=%229782412049402%22

metaodi commented 4 years ago

Wow, I'm amazed you found this repository. Thank you for reporting and providing PRs. sruthi is certainly still in beta and has a few rough edges. Really appreciate that you took the time to contribute.

edipretoro commented 4 years ago

Well, I was searching for a SRU client in Python, and was happy to find your module. And when I was testing it, I found problems that I could easily solve, so I did it :smile:

As I intend to write some personal tools that needs a SRU client, tell me how I can help you to smoothen the edges of sruthi

metaodi commented 4 years ago

I want to check if there is a way to find these "typos" using the explain operation (i.e. configure the client with response of the server).

edipretoro commented 4 years ago

For as long as I know, the SRU/SRW norm asked for the string: searchRetrieve, and I was surprised that the SRU server used in your examples was not working with that string. I've checked the searchretrieve operation with some of the SRU servers in that list and it resulted in a unsupported operation.

I didn't find any kind of reusable information in the explain operation.

My current fix was to let the programmer specify the string to use, but maybe a better solution would be to specify a profile for a server, and let the client used it.

metaodi commented 4 years ago

yeah it should be searchRetrieve, it's actually a fix I already made (see #30). I guess the server I'm using accepts both, so let's use the term defined in the standard.

metaodi commented 4 years ago

Fixed in release 0.1.1, see #30 for details.