fair-workflows / nanopub

Python client for searching, publishing and modifying nanopublications.
https://fair-workflows.github.io/nanopub
Apache License 2.0
22 stars 7 forks source link

NanopubClient server recon fails on timeouts #163

Open Ostrzyciel opened 11 months ago

Ostrzyciel commented 11 months ago

In the NanopubClient._query_grlc_try_servers method, all available grlc servers are tried by checking if they don't return HTTP 502. This breaks on other types of failures, like timeouts. If one of the server times out (and currently https://openphacts.cs.man.ac.uk/nanopub/grlc/api/local/local/ does), the method raises an exception and everything falls apart.

A workaround is to modify the grlc_urls field to exclude the server producing timeouts.

A permanent solution would be to probably rewrite this method, including shorter timeouts (the default one is very long) and handling for more HTTP status (anything that isn't 200 = error?).