Open yusufaliozkan opened 1 month ago
Hard to say without seeing the error, but it seems likely to be on the server side if that call was working for you previously.
Thanks for the swift response!
The error message is as follows: Could the server error be solely responsible for zot.everything
producing an error?
HTTPError: 500 Server Error: Internal Server Error for url: https://api.zotero.org/groups/2514686/items/top?limit=10&start=30&locale=en-US
The above exception was the direct cause of the following exception:
HTTPError Traceback (most recent call last)
Cell In [3], [line 6](vscode-notebook-cell:?execution_count=3&line=6)
[3](vscode-notebook-cell:?execution_count=3&line=3) api_key = '' # api_key is only needed for private groups and libraries
[4](vscode-notebook-cell:?execution_count=3&line=4) zot = zotero.Zotero(library_id, library_type)
----> [6](vscode-notebook-cell:?execution_count=3&line=6) items = zot.everything(zot.top(limit=10))
[7](vscode-notebook-cell:?execution_count=3&line=7) # items = zot.items()
[8](vscode-notebook-cell:?execution_count=3&line=8) data3=[]
File c:\Users\yaozk\AppData\Local\Programs\Python\Python310\lib\site-packages\pyzotero\zotero.py:865, in Zotero.everything(self, query)
[863](file:///C:/Users/yaozk/AppData/Local/Programs/Python/Python310/lib/site-packages/pyzotero/zotero.py:863) items.extend(query)
[864](file:///C:/Users/yaozk/AppData/Local/Programs/Python/Python310/lib/site-packages/pyzotero/zotero.py:864) while self.links.get("next"):
--> [865](file:///C:/Users/yaozk/AppData/Local/Programs/Python/Python310/lib/site-packages/pyzotero/zotero.py:865) items.extend(self.follow())
[866](file:///C:/Users/yaozk/AppData/Local/Programs/Python/Python310/lib/site-packages/pyzotero/zotero.py:866) except TypeError:
[867](file:///C:/Users/yaozk/AppData/Local/Programs/Python/Python310/lib/site-packages/pyzotero/zotero.py:867) # we have a bibliography object ughh
[868](file:///C:/Users/yaozk/AppData/Local/Programs/Python/Python310/lib/site-packages/pyzotero/zotero.py:868) items = copy.deepcopy(query)
File c:\Users\yaozk\AppData\Local\Programs\Python\Python310\lib\site-packages\pyzotero\zotero.py:154, in retrieve.<locals>.wrapped_f(self, *args, **kwargs)
[152](file:///C:/Users/yaozk/AppData/Local/Programs/Python/Python310/lib/site-packages/pyzotero/zotero.py:152) if kwargs:
[153](file:///C:/Users/yaozk/AppData/Local/Programs/Python/Python310/lib/site-packages/pyzotero/zotero.py:153) self.add_parameters(**kwargs)
--> [154](file:///C:/Users/yaozk/AppData/Local/Programs/Python/Python310/lib/site-packages/pyzotero/zotero.py:154) retrieved = self._retrieve_data(func(self, *args))
[155](file:///C:/Users/yaozk/AppData/Local/Programs/Python/Python310/lib/site-packages/pyzotero/zotero.py:155) # we now always have links in the header response
[156](file:///C:/Users/yaozk/AppData/Local/Programs/Python/Python310/lib/site-packages/pyzotero/zotero.py:156) self.links = self._extract_links()
File c:\Users\yaozk\AppData\Local\Programs\Python\Python310\lib\site-packages\pyzotero\zotero.py:407, in Zotero._retrieve_data(self, request, params)
[405](file:///C:/Users/yaozk/AppData/Local/Programs/Python/Python310/lib/site-packages/pyzotero/zotero.py:405) self.request.raise_for_status()
[406](file:///C:/Users/yaozk/AppData/Local/Programs/Python/Python310/lib/site-packages/pyzotero/zotero.py:406) except requests.exceptions.HTTPError as exc:
--> [407](file:///C:/Users/yaozk/AppData/Local/Programs/Python/Python310/lib/site-packages/pyzotero/zotero.py:407) error_handler(self, self.request, exc)
[408](file:///C:/Users/yaozk/AppData/Local/Programs/Python/Python310/lib/site-packages/pyzotero/zotero.py:408) backoff = self.request.headers.get("backoff") or self.request.headers.get(
[409](file:///C:/Users/yaozk/AppData/Local/Programs/Python/Python310/lib/site-packages/pyzotero/zotero.py:409) "retry-after"
[410](file:///C:/Users/yaozk/AppData/Local/Programs/Python/Python310/lib/site-packages/pyzotero/zotero.py:410) )
[411](file:///C:/Users/yaozk/AppData/Local/Programs/Python/Python310/lib/site-packages/pyzotero/zotero.py:411) if backoff:
File c:\Users\yaozk\AppData\Local\Programs\Python\Python310\lib\site-packages\pyzotero\zotero.py:1644, in error_handler(zot, req, exc)
[1642](file:///C:/Users/yaozk/AppData/Local/Programs/Python/Python310/lib/site-packages/pyzotero/zotero.py:1642) raise ze.HTTPError(err_msg(req))
[1643](file:///C:/Users/yaozk/AppData/Local/Programs/Python/Python310/lib/site-packages/pyzotero/zotero.py:1643) else:
-> [1644](file:///C:/Users/yaozk/AppData/Local/Programs/Python/Python310/lib/site-packages/pyzotero/zotero.py:1644) raise ze.HTTPError(err_msg(req)) from exc
HTTPError:
Code: 500
URL: https://api.zotero.org/groups/2514686/items/top?limit=10&start=30&locale=en-US
Method: GET
Response: An error occurred
Yep – HTTP errors are caught but surfaced so that you (or I) can see what went wrong. In this case, we really don't have much to go on since internal errors on the server side typically don't convey much extra information. I will note two things, however:
.everything()
call doesn't make much sense; everything
exists to automate the pagination that the Zotero API provides – you typically use it in order to retrieve e.g. all top-level items, but you've restricted it to fetch chunks of 10 at a time. Is there a specific reason for that? What happens when you remove the limit=10
argument?zot.top(start=30, limit=10)
? limit=10
argument, I've got the same error.
HTTPError:
Code: 500
URL: https://api.zotero.org/groups/2514686/items/top?limit=100&start=800&locale=en-US
Method: GET
Response: An error occurred
zot.top(start=30, limit=10)
argument still gives the same error.In that case it looks to be wholly on the server side – you may be able to bring this to their attention on the forum.
@yusufaliozkan Did you figure this out? Trying to familiarize myself with pyzotero and getting the same error
Platform: Jupyter notebook Python version: 3.10.6 Pyzotero version: 1.5.25
Problem Description
zot.everything(zot.top(limit=10))
. When I try, it gives Error 500 suggesting the error is related to the Zotero server. It was working fine until this morning. There was an issue with the Zotero server discussed in the forum this morning. I'm not entirely sure if the error I got is related to the server issue but other elements ofpyzotero
are working fine.