Closed johndoe46 closed 2 years ago
Hi! Before I have a look at this diff, please revert all the formatting changes. That looks like everything other than the removal of line 84 and the additions from 138-140.
Hi! Before I have a look at this diff, please revert all the formatting changes. That looks like everything other than the removal of line 84 and the additions from 138-140.
Are you sure ? This is the result of Black, as requested by your PR policy.
Are you sure ? This is the result of Black, as requested by your PR policy.
The latest release (22.1) leaves it unchanged…
Whoops, dev
was significantly behind for some reason. Apologies, my fault.
I closed this one because not based on dev, but it has the fix and not the formating issue: https://github.com/urschrei/pyzotero/pull/150
Sorry, the github interface is driving mad. It's actually very simple and just 3 lines:
diff --git a/pyzotero/zotero.py b/pyzotero/zotero.py
index 2290fc2..41222d5 100644
--- a/pyzotero/zotero.py
+++ b/pyzotero/zotero.py
@@ -63,7 +63,6 @@ from . import zotero_errors as ze
# Avoid hanging the application if there's no server response
timeout = 30
-socket.setdefaulttimeout(timeout)
def build_url(base_url, path, args_dict=None):
@@ -108,7 +107,7 @@ def tcache(func):
"""
query_string, params = func(self, *args, **kwargs)
r = Request(
- "GET", build_url(self.endpoint, query_string), params=params
+ "GET", build_url(self.endpoint, query_string), params=params, timeout=timeout
).prepare()
# now split up the URL
result = urlparse(r.url)
@@ -1090,7 +1089,7 @@ class Zotero:
params = {"locale": self.locale}
query_string = "/itemFields"
r = Request(
- "GET", build_url(self.endpoint, query_string), params=params
+ "GET", build_url(self.endpoint, query_string), params=params, timeout=timeout
).prepare()
# now split up the URL
result = urlparse(r.url)
Fixed in 42ee686b8d8a817bdcad92404a80ef4ed798a418 & 2ee78e844e7b740bcefa0586ab198532135805fd, released to PyPI as v1.5.2
Thanks a lot ! 🙏
Timeout should be set at the request level, not at the module level to prevent breaking the defaults for other parts of the applications.