Add timeout option
elya5 opened this issue · comments
Hi
as the crossref API can be a bit slow sometimes, it would be great if there was a timeout option that could be passed to the requests call. As far as I know, this is not possible right now.
Python version: 3.10.8
habanero version: 1.2.2
Thanks for the issue.
I have an example here in the docs https://github.com/sckott/habanero/blob/main/habanero/__init__.py#L25-L38 of how to configure curl options, in that example to turn on verbose curl output. I imagine you can also set a timeout using that method but im not sure.
I'd prefer not to change the package api, but may consider it.
As far as I can tell, it is not possible to set this via the "curl options way" because the timeout is not a class attribute but passed to the constructor.
However, I do understand your hesitation to change the API.
would you want to use timeout across all methods in this library or just certain ones?
I am only using the works
method. When I'm automatically fetching bigger sets of articles, it occasionally fails/hangs.
Sorry for the delay ...
Okay, I'll see about adding this