Output limit at 100 in PyZotero

183 views
Skip to first unread message

Monika Renate Barget

unread,
Feb 24, 2021, 9:45:18 AM2/24/21
to zotero-dev
Hello!

I am using PyZotero to read data from group libraries and realised that the diplay of items (at least in collections within libraries) and tags is limited to 100.

Why is that, and is there a way to raise this limit?

I am using Python 3.7 on Anaconda.

Thanks for your help -- and sorry if I missed this info in the documentation.

Monika

Dan Stillman

unread,
Feb 24, 2021, 4:46:21 PM2/24/21
to zoter...@googlegroups.com
On 2/24/21 9:45 AM, Monika Renate Barget wrote:
> I am using PyZotero to read data from group libraries and realised
> that the diplay of items (at least in collections within libraries)
> and tags is limited to 100.
>
> Why is that, and is there a way to raise this limit?

All API responses are limited to 100 objects — that's not specific to
pyzotero.

https://www.zotero.org/support/dev/web_api/v3/basics#sorting_and_pagination_parameters
https://pyzotero.readthedocs.io/en/latest/#the-follow-and-everything-methods

Mona Barget

unread,
Mar 4, 2021, 4:13:17 AM3/4/21
to 'John Lees-Miller' via zotero-dev
Dear Dan,

I am not sure why, but some APIs I am using for geocoding etc. permit responses of up to 500 items. That is why I was wondering. In any case, I found a way to analyse the tags of all 179 objects in my current library by calling each item via its own API URL. I am not sure that is encouraged. The reason why I am not working with a data dump in JSON is that colleagues and I are regularly updating the tags and that we need stats "on the fly".

Best, Monika 

Monika Barget
Breslauer Straße 9
D-65203 Wiesbaden
--
You received this message because you are subscribed to the Google Groups "zotero-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to zotero-dev+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/zotero-dev/01000177d601cb62-a62160d6-0fb0-401a-937f-d978921a87d4-000000%40email.amazonses.com.

Dan Stillman

unread,
Mar 4, 2021, 4:36:40 AM3/4/21
to zoter...@googlegroups.com
On 3/4/21 4:13 AM, Mona Barget wrote:
I am not sure why, but some APIs I am using for geocoding etc. permit responses of up to 500 items. That is why I was wondering. In any case, I found a way to analyse the tags of all 179 objects in my current library by calling each item via its own API URL. I am not sure that is encouraged. The reason why I am not working with a data dump in JSON is that colleagues and I are regularly updating the tags and that we need stats "on the fly".

To be clear, if the problem is solely the 100-object limit, you should absolutely be using the supported pagination parameters — they're designed to efficiently give you paged results. The API could easily block you for rapidly making individual-item requests, even if doesn't now.

An API's single-request object limit doesn't particularly matter as long as it supports some sort of pagination.

Mona Barget

unread,
Mar 4, 2021, 5:18:20 AM3/4/21
to 'John Lees-Miller' via zotero-dev
Thanks, Dan, it took me some time to understand the documentation, but I gather that if I use "start=100", I can display results 100 to 200.

Monika Barget
Breslauer Straße 9
D-65203 Wiesbaden

Dan Stillman

unread,
Mar 4, 2021, 5:24:35 AM3/4/21
to zoter...@googlegroups.com
On 3/4/21 5:18 AM, Mona Barget wrote:
Thanks, Dan, it took me some time to understand the documentation, but I gather that if I use "start=100", I can display results 100 to 200.

Yes, but you don't have to do it manually. pyzotero will do it for you, and if you use the API directly it returns a Link header (covered in the documentation) with the appropriate next URL.

Monika Renate Barget

unread,
Mar 8, 2021, 10:17:37 AM3/8/21
to 'John Lees-Miller' via zotero-dev
Thanks again, I figured out how to use the everything() function in Pyzotero and handle webpage snapshots (which were causing errors).
There might be a more efficient way to get there, but this script is working for me now: https://github.com/MonikaBarget/DigitalHistory/blob/master/TAGstats_PyZotero.py

--
You received this message because you are subscribed to the Google Groups "zotero-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to zotero-dev+...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages